Hi, below is my use case.
Below is the script i have
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
def customFieldManager = ComponentAccessor.customFieldManager
CustomField customFieldDE = customFieldManager.getCustomFieldObjectByName("RPR DE Return Reason")
CustomField customFieldPM = customFieldManager.getCustomFieldObjectByName("RPR PM Return Reason")
def customFieldtrail = customFieldManager.getCustomFieldObjectByName("RPR Return Err Code Trail")
def customFieldtrailval = getCustomFieldValue(customFieldtrail)
//System.out.println("Custom field value: " + customFieldtrailval)
StringBuilder stringBuilder = new StringBuilder()
stringBuilder.append(customFieldtrailval)
((List<Option>) issue.getCustomFieldValue(customFieldDE)).each {
stringBuilder.append(it.getValue()).append(", ")
}
((List<Option>) issue.getCustomFieldValue(customFieldPM)).each {
stringBuilder.append(it.getValue()).append(", ")
}
return stringBuilder.toString()
The issue i have is on the bold line. it is lways returning Null.
below is what i get
nullD1-1(Incorrect Revenue),
Kindly advise, if there are better options to handle this .
Thanks in advance
Hello,
I think you may be better off using a listener for this purpose, then putting the result that the listener calculates into a custom field if you need it displayed.
You should be able to use similar code, with a few modifictions to access fields and such.
You can read more about listeners here.
Let me know if you need any help setting this up!
Jenna
Thank you Jenna, will try and keep this thread updated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.