Automation to send slack message on 2nd and subsequent changes

Lori Milam
Contributor
November 11, 2024

I need to write an automation for when a custom field changes to send a slack message only on 2nd and subsequent changes. For example, field name is Quarter committed. It remains empty for a while. When they are ready to commit to a quarter they enter a value. No slack message should be sent. After this, then any change including back to empty needs to send a slack message. Is there a way to tell when the value has changed the first time without checking "empty"? Like looping through the history of a field?

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
November 12, 2024

Hi @Lori Milam 

If your rule is triggered on a change to the field, you could try using the {{changelog}} smart value and test if the {{fromString}} is not empty.  That would indicate the value changed.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog--

If this does not help, please post an image of your complete rule and the audit log details showing the rule execution.  These will provide context for the community to offer better suggestions.

Kind regards,
Bill

Lori Milam
Contributor
November 12, 2024

Hi @Bill Sheboy one question. Using the changelog fromstring only shows me what it is changing from for this one change, right? This wouldn't necessarily tell me if it has changed back to empty previously, so not the very first change to this field. Am I thinking about this correctly?

Bill Sheboy
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.
November 12, 2024

Well done thinking of the different cases!  They would be this:

  • empty value => non-empty value
  • non-empty value => a new non-empty value
  • non-empty value => empty value

You could use the current value and {{fromString}} to test with if / else conditions and handle the paths needed.

Lori Milam
Contributor
November 14, 2024

Thank you. I have this part figured out. The part that I'm stumbling on is if the user goes from non-empty value to empty value, then assigns the empty value to non-empty value a second time, they want to receive the notification.

So the only time they don't want the notification is if the field hasn't been touched at all since creation and they change it for the very first time. Any changes after that they want the notification.

So it's like I need to be able to look back at the history of the changes or I need to flag it in some way at creation.

Bill Sheboy
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.
November 14, 2024

Within a rule...it is theoretically possible to use the issue history to check such scenarios, however as the history (i.e., change log) could have many entries, repeated paging of REST API calls with the Send Web Request could be needed.  That gets messy very quickly.

It may be better to use a custom field or entity property to indicate "this has happened!" as a one-time switch, and check that value to help with the decision making.

 

I recommend pausing and mapping out all the scenarios you want to support and their likelihood.  That will help know how many rules are needed and what to test.

Lori Milam
Contributor
November 14, 2024

Thanks for the input Bill. I actually went down a rabbit hole and discovered Set Entity Properties which has gotten me very very close to what I'm trying to accomplish.

Step 1 

Step1.PNG

Step 2

Step2.PNG

The issue property then holds that value and will increment it every time the value is changed.

Like Bill Sheboy likes this
0 votes
Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2024

Hello, Good day. What is the field type, we can try to use different if/else condition in the rule based on field type.

Lori Milam
Contributor
November 12, 2024

Hi @Mohanraj Thangamuthu it is a Select List (single choice). The trigger is when value changes.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events