Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,994
Community Members
 
Community Events
165
Community Groups

Automation for Jira - Update Json field

Hi,

I have a field in Jira coming from a plugin (CRM for Jira) that the Automation doesn't see.

Now I have an Automation rule, that starts with an EPIC - and if I set up a value in that custom field (10951) I get that value through JSON and I apply it to the tasks I create under that epic.

But in case I update that value of that custom field in the EPIC - how can I update it in the tasks created under him also?

This is the automation:

Jira-Automation-Help.png

1 answer

@Albert 

Maybe you can do this:

Create the initial scope of your automation and after the condition of "Issuetype" = Epic

Add a BRANCH;
Use the option "Branch rule / related issues";
Select the "Stories (or other issues in Epic)" option

After that, inside the BRANCH add the "Edit Issue" action and place the JSON normally in "Additional fields".

I'm not sure if in Jira Server it's the same format, but you can start with a JSON similar to this:

 

{
"update": {
"customfield_10951": [{
"set": "{{triggerIssue.customfield_10951}}"
}]
}
}

I believe if you create a new automation just for this update it will be more effective.

Then create an automation like:

TRIGGER: Field Value Changed > Custom field 10951

Condition: issuetype = Epic

BRANCH > Related issues

"Stories (or other issues in Epic)"

Inside BRANCH > Edit issue > Additional Fields and put the JSON.

 Hope this helps :)

@Fernando Eugênio da Silvathanks alot for the answer.

So i have applied your json, is working - in terms that is updating the field I have but the automation is throwing an error.automation-error.png

Do you know what's wrong with this or how to fix it?

Also with this custom field (10951) I had it in the Summary of the same automation rule like:

{{customfield_10951.value}} My Summary text

 

Is there a way to update this value also when I update the value of the custom field 10951?

This is how it looks:

jira-automation-2.png

Thanks alot.

Albert,

About the error you are seeing, can you confirm if the ID field 10951 is a custom field of type select list or checbox?

This changes the JSON structure a bit.

As for updating the summary also when the field is edited, I would recommend the following:

Create a new automation with the following details:
Screenshot_5.png

Normally configure the CONDITIONS;
Add the BRANCH as previously guided and in EDIT ACTION you can do as follows:
Screenshot_6.png

But if you want to do it directly by JSON, you would not need to indicate the summary in "Edit fields", just pass it in the "Additional Fields" load.

Here's JSON that might help you:

{
"update": {
"customfield_10951": [{
"set": "{{triggerIssue.customfield_10951}}"
}],
"summary": [{
"set": "{{triggerIssue.customfield_10951}}"
}]
}
}

 If this doesn't work as expected or it's still not what you're looking for, I look forward to more details so we can keep moving forward here :)

Hi @Fernando Eugênio da Silva the field 10951 is a select list type (single choice).

 

Unfortunatly if I set

"summary": [{
"set": "{{triggerIssue.customfield_10951}}"

I will update the entire title of my ticket with the value of the field 10951.

What i have in my summary field is:

{{customfield.10951.value}} + This is my text

And is not keeping "This is my text" is updating te whole name.

Albert,

Please, try this:

 

{
"update": {
"summary": [{
"set": "{{triggerIssue.customfield_10951}} + This is my text"
}]
}
}

 

I tried this and it worked as expected.

However, to do this you have to indicate the summary value only by JSON and not load it as a field in the creation. You need to indicate it here only:

Screenshot_11.png

 

Let me know if this works for you and share any error that appear

Suggest an answer

Log in or Sign up to answer
TAGS

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