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

Automation: Set person field to initiator of transition

Brendan Sheppard October 18, 2023

Hi all

 

I've just migrated from JIRA server to cloud instance using team managed projects.  I'm re-building my workflow and automation rules, and thus far workflow was similar and therefore easy, but I've been going around in circles to sort out my first automation.

In server, it looked like the below where upon a transition, I would set the developer (customer person) field to the user who was the assignee at the time.

Developer automation.jpg

So in my cloud instance I've gone and setup a new person field to match, yet when I try to find the rule in the action trigger the field doesn't show.  I tried to find solutions for this with no luck, so have tried the coding option (and I'm not a coder)...

I found my custom field id to be cf[10246] so I've tried a few things but this is what it looks like and no surprise it's not working!  Maybe I'm not even close, but given my lack of experience I feel like I've had a fair crack.....

custom code.jpg

Any help would be greatly appreciated, please.

 

Thanks, Brendan

2 answers

1 accepted

1 vote
Answer accepted
Brendan Sheppard October 19, 2023

So through sheer persistence and trial and error I've solved this.  Formula that worked is:

{
"update": {
"customfield_10246": [{
"add": {
"id": "{{initiator.accountId}}"
}
}]
}
}

 

Thank you @Mikael Sandberg for the post here

 

What a mission for something that took me 1 minute on the server!  

 

Thanks all of you for chipping in.  I'm exhausted!

0 votes
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 18, 2023

Hi @Brendan Sheppard 

 

I'm not sure if capital letters make difference but can you try to use {{initiator.accountId}} ?

Also what I see is that after }} there is a dot. Please remove it.

 

Regards,

Seba

Brendan Sheppard October 19, 2023

Thanks for the quick reply @Sebastian Krzewiński, it's much appreciated.

I (think I) made those adjustments but it still failed.

updated JSON.jpg

Also, the error message isn't helpful, just still advises incorrect JSON. 

Elyes Gannoun [Elements]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2023

Hey @Brendan Sheppard ,

Just pointing out the obvious here but we never know! 
If the JSON is incorrect, could it be because of the comma you have at the end of the 4th line, next to the initiator accound Id variable?

Brendan Sheppard October 19, 2023

Hi @Elyes Gannoun [Elements]  I can't code so nothing is obvious :D 

I removed that but still no luck.

I tried changing the custom field id also to "customfield_10246" as I had seen it displayed like this but that also didn't work.

Elyes Gannoun [Elements]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2023

@Brendan Sheppard - I tried something on my end that worked which differs a bit from what you've configured:

For an automation action "Edit issue" in the additional fields section, I've written:

{
"fields": {
"Custom field name": "Custom field value"
}
}

Just try to put the name instead.

What is the custom field 10246 type ? If it's a user type, the object must be different

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events