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?
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done thinking of the different cases! They would be this:
You could use the current value and {{fromString}} to test with if / else conditions and handle the paths needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Step 2
The issue property then holds that value and will increment it every time the value is changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Good day. What is the field type, we can try to use different if/else condition in the rule based on field type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.