Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with JIRA Automation Rules Order/Chain Involving Custom User Fields

Amin January 3, 2024

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

 

102.png

3 answers

1 accepted

0 votes
Answer accepted
Amin July 7, 2024

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.

0 votes
John Funk
Community Champion
January 3, 2024

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? 

Amin January 4, 2024

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


John Funk
Community Champion
January 4, 2024

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

Amin January 4, 2024

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.");
John Funk
Community Champion
January 6, 2024

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!

Like Amin likes this
0 votes
Geethanjali Katagani
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.
January 3, 2024

Hi @Amin ,

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

Amin January 4, 2024

Hi @Geethanjali Katagani

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,

Geethanjali Katagani
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.
January 5, 2024

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

Like Amin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events