Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Automation to update One Custom Field based on another based on the value position in the list order

Hi,

 

I have two fields of over 600 options, and I want to run automation to fill out the second field with a value that is in the same position in the first fields list.

 

For example:

Custom Field One Values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10....600

 

Custom Field Two Values: A, B, C, D, E, F, G, H, I, J...ZZZZ

 

 

I would want it to match up based on the position of each list like this:

A|1

B|2

C|3

D|4

E|5

 

Can that be done through JSON? Or is there any other method to add this in without manually entering over 600 automation rules?

1 answer

1 accepted

2 votes
Answer accepted
Mikael Sandberg Community Leader Jan 12, 2022

It should be possible to get the value by using the Send web request to the REST API to get the value for the second field. You can find the API call to use here.

Thanks Michael,

That seems to solve half the issue (getting the Values quickly), but is there a way to make it update the second field in the manner I mentioned (so contextId1 of Field One adding contextId1 to Field Two)?

Mikael Sandberg Community Leader Jan 12, 2022

Yes, if you wait for the result to come back from the web request, you can get the value for the specific position and then use a smart value to set the second field.

Really sorry Mikael, this is very new to me and I don't really understand what you're saying.

 

Within the Automation page itself, if I go to Send Web Request, I can see where to enter the URL for requesting, but beyond entering; https://your-domain.atlassian.net/rest/api/3/field/{fieldId}

I am at a loss as to what to do next to make this happen.

Mikael Sandberg Community Leader Jan 12, 2022

No worries Chris, we have all been there.

So the URL needs to contain the fieldID and the context ID, you can get both of these either from within Jira if you go to administration > issues > custom fields, or your other option is to get it via REST API. Once you have those two IDs you will also have to add two headers, one for "Accept: application/json" and the second one for the authentication, something like this "Authentication: Basic <username:token>".

The returning result from that request can then be used to find the corresponding value and be used to set the field.

Thanks Mikael,

Will I need to run this twice in the same automation rule? Once for each field?

 

And then with regards to how I set that second field (because the values are different not the same), what's the step I would have to take there? Like I said there's over 600 in each field, so I am hoping it is as simple as saying Value in position 1 in Field One should equal value in position 1 in Field Two etc...

 

Is that what will come out of that result?

Mikael Sandberg Community Leader Jan 12, 2022

Yes, you would have to run it twice, one for each field.

Instead of using automation for this I would probably go with an external option, you can then use two lists to map the values from both fields.

I already have a CSV with both fields values lined up correctly of that is of any use?

 

That's how the fields were imported to begin with.

Mikael Sandberg Community Leader Jan 12, 2022

It does, if you use an external option to set the second field. Then you would just need to get value for field one, look it up in the csv, and send an update request back. Automation can only part of this, so you would have to rely on something like tray.io to do the lookup and either send the value back to automation, or set via a api call.

I have sort of a similar workflow going, were automation triggers a workflow in tray.io to look up a reporter's manager in Okta and then return that value to the automation that then sets a manager field in Jira.

That's great. Thanks for all the help Mikael, I will have a look. Anything that avoids me needing to setup 600 Automation rules!!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

761 views 24 28
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