Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Set assignee from Reporter

Hello there,

using Jira Cloud I am thinking of how to set a JMWE using Nunjucks to:

  • set Assignee to Person 1 if the reporter is Person 1 or Person 2 OR ELSE set it to Person 3 if the reporter is different.

Now I know there is an Assign to a Project Role part, but I need to avoid adding new project roles and post-function Build your scrtipt seemed fine.

Now I've gotten here:

{% if issue.fields["Reporter"].accountId == "accountId:5cd52aaf8ad0f60dca007cef" or issue.fields["Reporter"].accountId == "accountId:5cd44f0df58d4f0dc512d7f5"%}
{% set issue.fields.assignee.accountId = "accountId:5cd52aaf8ad0f60dca007cef" %}
{% else %}
{% set issue.fields.assignee.accountId = "accountId:5da42f701a43fe0ddbb43bab" %}
{% endif %}

Accounts in code - first is Person 1, then Person 2
set Person 1
else Person 3

But getting error while testing:

  TypeError: Cannot read property 'charAt' of undefined

Can anyone help?

3 answers

2 accepted

3 votes
Answer accepted

Hi @Tereza Červinková ,

you need to use a Set Field Value post-function instead, with this value:

{% if issue.fields["Reporter"].accountId == "accountId:5cd52aaf8ad0f60dca007cef" or issue.fields["Reporter"].accountId == "accountId:5cd44f0df58d4f0dc512d7f5"%}
{% else %}
{% endif %}
1 vote
Answer accepted

Thank you, @Alexander Bondarev and @David Fischer _Appfire_  for your help.

The set field value would definitely help me with that, though I have tried the original code, edited it and now it works. So now it is:

{% if issue.fields.assignee.accountId == "accountId:5cd52aaf8ad0f60dca007cef" or issue.fields.assignee.accountId == "accountId:5cd44f0df58d4f0dc512d7f5"%}
{{ issue.fields.assignee.accountId }} = "accountId:5cd52aaf8ad0f60dca007cef"
{% else %}
{{ issue.fields.assignee.accountId }} = "accountId:5da42f701a43fe0ddbb43bab"
{% endif %}
0 votes

Hi, @Tereza Červinková !

Unfortunatelly, I have never used JMWE in Cloud =(

Have you already checked examples from documentation - Use cases for post-functions . 

Also you can raise a supprort request on Customer Portal?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

203 views 6 7
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