Auto Setting the Approver as the Reporter for Customer Acceptance

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.

2 answers

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

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])

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked Feb 02, 2018 in Jira Service Desk

What are the must-have addons?

Hi all, We are trialing Jira Service Desk for a large-ish, flat, team-based organization where members can serve on multiple teams. A few needs that are not out of the box... Assigning i...

927 views 12 5
View question

Atlassian User Groups

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!

Find my local user group

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

Groups near you