I seem to being having issues setting the Approver as the Reporter as these are different data types and casting is most likely needed. Does anyone have a Scriptrunner example that does something like this? Thanks.
I someone ask me a similar question at Summit. Basically, JIRA Service Desk's Approvers field takes a list of ApplicationUser objects. To put the reporter in the Approvers field, you'd just need to put it in the list. Something like:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def approversField = customFieldManager.getCustomFieldObjects(issue).find{ it.name == "Approvers" }
def userManager = ComponentAccessor.userManager
issue.setCustomFieldValue(approversField, [issue.reporter])
Hey Stephen!
I could come up with an example for you really quick if you are able to give me juat a little bit more context.
When are you wanting this assignment to occur? When an issue has been created or when it has been closed out, etc...? Try to elaborate on your specific scenario. :)
Additionally, what two data types are you expecting from each of these fields?
Thanks! Aidan
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.