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)
Other notes:
- 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();
How run a simple query and return the result value? Example:
SELECT project.pname from project WHERE project.id='10600'
This code return one value. Test un database client....
Help please...
> 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.