Automation for Jira - Update Json field

Albert Manuel
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.
May 3, 2022

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

0 votes
Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 3, 2022

@Albert Manuel 

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 :)

Albert Manuel
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.
May 5, 2022

@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.

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2022

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 :)

Albert Manuel
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.
May 9, 2022

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.

Fernando Eugênio da Silva
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2022

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

Like Vitali likes this

Suggest an answer

Log in or Sign up to answer