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

JIRA Automation Add Current User to Custom Field

I am wanting to automatically have the current user added to a Multi User Custom Field (called 'Developer') when a story changes status.

I have setup JIRA automation (using JIRA Cloud) and have got the 'Current User' to be set as the assignee (that is working),  but have been having issues with trying to get the current user added to the custom field.

I have setup the following Automation rule:

image.png

Where under the 'Edit Issue fields': I have tried the following:

1.

{
"fields": {
"Developer": {{initiator.accountId.asJsonObject("id")}}
}
}

Which gave the error:  Additional fields contains invalid field(s) in 'update' or 'fields' section.

 

2.

{ 
"update": {
"Developer": [{
"add": {{initiator.accountId.asJsonObject("id")}}
}]
}
}

Which gave the error:  Additional fields contains invalid field(s) in 'update' or 'fields' section.

 

3.

{
"fields": {
"customfield_10045": {{initiator.accountId.asJsonObject("id")}}
}
}

and

{ 
"update": {
"customfield_10045": [{
"add": {{initiator.accountId.asJsonObject("id")}}
}]
}
}

Both of which don't give any errors.  But seem to only set the field like 5% of the time.   I haven't been able to work out why the custom field is sometimes updated and sometimes it isn't. 

2 answers

1 accepted

Thanks for your reply.  Have found that this is now working reliably:

 

{ 
"update": {
"customfield_XXXXX": [{
"add": {{initiator.accountId.asJsonObject("id")}}
}]
}
}

 

Not sure why it didn't seem to work last week, but have tested about 20 times today, and its worked every time.   

Is this still working for you? I'm trying to do the exact same thing. The automation reports success in the audit log, but the contents of the field don't change.

I've tried using the custom field ID as you listed it as well as the name — neither worked.

I've also tried the version that doesn't create the JSON object but it isn't working either, e.g.,

     "fieldname": { "id": "{{initiator.accountId}}" }

Any suggestions? 

@Brian Stults 

Yup,  we're still using the following code:

{ 
"update": {
"customfield_10038": [{
"add": {{initiator.accountId.asJsonObject("id")}}
}]
}
}

And this is working perfectly for us, where customfield_10038 is a multi user picker custom field.

 

One thing I noticed that caught me out a little when I was originally implementing this, was that it sometimes takes a few minutes for the changes to come through.  E.g. I would see the assignee field get updated really quickly on the UI (by the automation), but the multi user picker seemed to take a little longer and I had to manually refresh the page / JIRA story to see the changes.    But the changes are coming through for us. 

Hi @Jonathan Higgs _Digital Reign_ 

You can try setting up the developer field with the below smart value

{{initiator.displayName}}

Not a good idea - Jira Cloud will turn off display names at some point due to GDPR. It is better to use ids.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,047 views 8 28
Join discussion

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