Issue with JIRA Automation Rules Order/Chain Involving Custom User Fields
Asked by Amin:

Hi Community,

I'm working on setting up a chain of automation rules in our company's JIRA instance and have run into an issue I hope you can help with. I'm trying to automate the following process:

1. **Automation Rule 1:** When new users are added to Field A (called involvierte Personen), only the newly added users (excluding those who were already there) should be added to Field B (called Benachrichtigungsfeld). I've set this up using SIL, and it's working well.

2. **Automation Rule 2:** If the value of Field B changes, a comment should be posted, mentioning the new users that they've been added to Field A. However, this second rule doesn't execute, even though I've enabled the option "Check to allow other rule actions to trigger this rule" in Automation Rule 1.

The audit log for Automation Rule 2 shows no errors; it's as if nothing has triggered.

Can anyone offer some insights or solutions?

Thank you in advance for any help you can provide!

P.S.: I initially tried combining these rules into one, but the comment would mention the previous users in Field B, which seems like a synchronization issue. That's why I split them into two separate rules.

Best regards.

![101.png](https://community.atlassian.com/t5/image/serverpage/image-id/298688i77E58E31C7175AB5/image-size/large?v=v2&px=999 "101.png")

![102.png](https://community.atlassian.com/t5/image/serverpage/image-id/298689iDB8A3686683693E9/image-size/large?v=v2&px=999 "102.png")


Answers:
author: Amin
body: Update: the solution is using "Re-fetch issue data" after SIL automation steps. So Jira has all information needed for the next steps. Otherwise some data can be missing, because SIL automations can take longer (a few seconds) than Jira default automations.


author: John Funk
body: Hi Amin - Welcome to the Atlassian Community!

If the value for Field B is indeed getting updated, then the rule should fire.

If you try just updating Field B manually, does the rule fire?

If so, be sure that that box is definitely checked and you have published it as such. Can you share a screenshot of that?

comments: author: Amin
body: Hi John,  

Thank you!  

The value for Field B is getting updated by automation rule 1, but automation rule 2 doesn't get executed.

I've just tried changing the value for Field B manually and automation rule 2 got fired.

It seems the problem is that the autoamtion rule 1 cannot fire automation rule 2, although it changes the value for Field B.  

Please find the screenshot below.  

![103.png](https://community.atlassian.com/t5/image/serverpage/image-id/298884i61610754FF6F0DA1/image-size/large?v=v2&px=999 "103.png")  

<br />


author: John Funk
body: Well, that doesn't make any sense at all. Can you share the details of the SIL script?


author: Amin
body: Sure, but I should mention that I'm a beginner in SIL. The SIL script is functioning (apart from the sendEmail part).

```
//Function: subtraction 1 from the number
function sil_number(number a){
return a-1;
}

// get the changes in involvierten Personen = customfield_11402.
JFieldChange[] changes = getFieldChanges(key, "customfield_11402");
number size_changes = size(changes);

// last element is the one, which shows the last changes.
number last_element = sil_number(size_changes);
string[] last_big_element = getElement(changes, last_element);

// get the new value from involvierten Personen. The characters of [ and ] must get removed.
string[] new_val_with = getElement(last_big_element,4);
string[] new_val = substring(new_val_with, 1, sil_number(length(new_val_with)));
// don't forget to eliminate the space :)
string[] array_new_val = split(new_val, ", ");
runnerLog ("New value for involvierte personen: "+array_new_val);

// get the old value from involvierten Personen. The characters of [ and ] must get removed.
string[] old_val_with = getElement(last_big_element,3);
string[] old_val = substring(old_val_with, 1, sil_number(length(old_val_with)));
string[] array_old_val = split(old_val, ", ");
runnerLog ("Old value for involvierte personen: "+array_old_val);

// show the result, which is the difference between new and old values of the field involvierte ?ersonen.
string[] result = arrayDiff(array_new_val, array_old_val);
runnerLog("Result: "+result);

customfield_13103 = result;

//send the email
sendEmail(result, "Du wurdest als involvierte Person hinzugef?gt", "Hallo, " + currentUser() + " hat dich als involvierte Person zum Ticket " + key + " hinzugef?gt.");
```


author: John Funk
body: So you verified that Field B is getting updated by the SIL script by looking at the history of the issue? But the second rule based on Field B getting updated is not firing.

Is that correct? If so, then you should open a support ticket with Atlassian to find out what is going on that the second rule does not fire.

Please post the resolution back here for future readers of this post.

<https://support.atlassian.com/contact/#/>

Good luck!


author: Geethanjali Katagani
body: Hi [@Amin](/t5/user/viewprofilepage/user-id/5307572) ,

Please check separately whether the value of FieldB is updated by the first automation. The second automation should be triggered only if there is a change in the value of FieldB.

Thanks,

Geethanjali

comments: author: Amin
body: Hi [@Geethanjali Katagani](/t5/user/viewprofilepage/user-id/5015552)

Field B gets updated by the first automation but the second automation doesn't get triggered, unless I change the value for Field B manually.

Thank you,


author: Geethanjali Katagani
body: Hi Amin,

Apologies for the delayed response.

Following the update of Field B in the first automation, please proceed with the following steps:

1. Issue Condition: Field B = Any Changes  
2. Action: Add Comment

This sequential approach ensures that the comment is added only after the verification of changes to Field B.

Feel free to reach out if you have any questions or doubts.

Best regards,

Geethanjali


Tags: jira

jira-software

jira-software-server

server