I have to automatically get the value of a custom field from one issue put into a scripted field of another issue. I am not doing the search, results and return correctly but don't know where to go for more information.
Issue Type A:
- is the issue type that I'm adding a scripted field to
- has a field called "My Store ID"
- has a scripted field that will contain a working version of the code listed here
Issue Type B:
- is the issue type that I need to search
- has a field called "Store ID" (this is the field in the issue that I need to compare to the value of the other issue's "My Store ID" field)
- The "~" works with an advanced issue search with the "Store ID" field.
- The issueFunction in issueFieldExactMatch() query works as an advanced filter and returns the proper result if I substitute "abc123" with an actual "Store ID" value.
Here is what I am trying (unsuccessfully) to do:
import com.atlassian.jira.issue.Issue; import com.atlassian.jira.ComponentManager; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.component.ComponentAccessor; def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("My Store ID"); def abc123 = issue.getCustomFieldValue(field); def searchResults = issueFunction in issueFieldExactMatch('project = "PROJ" AND issueType = "STORE SUMMARY" AND "Store ID" is not Empty', "Store ID", abc123) def resultsfield = searchResults.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Store Name"); return resultsfield.toString();
> def searchResults = issueFunction in issueFieldExactMatch('project = "PROJ" AND issueType = "STORE SUMMARY" AND "Store ID" is not Empty', "Store ID", abc123)
is wrong. You need to get a JqlQueryParser, get a query, and run the query with a SearchService or somesuch. There are examples for this.
Sound like possibly not the most efficient way of doing what you're trying to do, which I admit I didn't totally understand.
Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs