Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ScriptRunner post-function - Update Approvers in SD Request Edited

Hi community,

I am trying to use a ScriptRunner post-function to clone a SD Request into a new SD Request. In the newly created request, approvers are not automatically added, and therefore I would like to define them in the ScriptRunner cloning post-function.

Here is my code:

def cfChange = customFieldManager.getCustomFieldObjectByName("Approvers")
def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserObject("USERNAME")
issue.setCustomFieldValue(cfChange, user)

But I get this exception:

java.lang.NullPointerException: Cannot get property 'id' on null object
test

What's the correct way to add a group of approvers in the "Approvers" JSD custom field?

I found this in the official documentation, but it's not helping me much:

https://scriptrunner.adaptavist.com/5.6.8/jira/recipes/workflow/postfunctions/auto-add-reviewer-to-request-SD.htm

Thanks in advance for your help.
Cheers,

David

1 answer

1 accepted

0 votes
Answer accepted

I finally found the solution... The Approver field used by the customer was a new translated field. It worked much better using the following:

def cfChange = customFieldManager.getCustomFieldObjectByName("Approbateurs")

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

How to log work and track time in Jira when a person is part of multiple teams

  The manager’s daily activities include a list of challenges to reach high levels of efficiency for their teams. Part of these challenges is related to how to deal with the worklog systems sin...

92 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you