Advice on using automation to change a field based on from/to values from another field

Carl P November 19, 2024

Hi there,

I am attempting to create an automation that will change a field based on from/to values of another field.

The automation is set to trigger when Field A is modified (Field A is a custom read only text field, which is set by two other fields changing to produce a value - this is set in another automation). This is displayed as Status Update in the automation image.

Based on the previous and current values of what Field A is set to, I am attempting to set a value in Field B (Custom field which is a single select.) This is displayed as Rating in the automation image.

The logic is as follows:

  • If Field A's value moves from High to Medium - then set Field B to Decrease
  • If Field A's value moves from Medium to High - then set Field B to Increase
  • If Field A's value moves from Low to High - then set Field B to Increase

and so on.

I have attempted to use fieldChange.fromString and fieldChange.toString in the automation to read the values from Field A, but from what I understand, these aren't supported by the type of field that Field A is (Custom read only text field)

Field B is used to monitor if the Rating has got better or worse, and used for specific reports.

automation.png

Any suggestions or advice would be greatly appreciated.

2 answers

2 accepted

2 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 19, 2024

Hi @Carl P -- Welcome to the Atlassian Community!

First, what does the audit log show when you run the rule?  Do the steps you expect to run happen?

 

Next, let's confirm what the smart value (or custom field id) are for your field.  This is important because when an incorrect one is used, that just returns as null and may not show as an error.

You may use this how-to article to find them: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Next, I recommend experimenting to learn if the change log values are set when your custom field changes.  Those are:

You may use a couple of writes to the audit log after the trigger to check these.  Perhaps with these expressions below.  Remember to substitute in the correct smart value and custom field id for your field.

The fromString from the changelog with the smart value is: {{#changelog.Status update}}{{fromString}}{{/}}

The fromString from the changelog with the custom field id is: {{#changelog.customfield_12345}}{{fromString}}{{/}}

The fromString from the fieldChange is: {{fieldChange.fromString}}

 

Finally, after you re-test you will learn which expression works for the field edit.  That may then be used in one of these: if / else conditions, a conditional expression, or using a Lookup Table to set your Rating field:

 

Kind regards,
Bill

Carl P November 19, 2024

Hi @Bill Sheboy - Thank you very much for your response.

To answer your questions - nothing shows up in the audit log for the automation, so it doesn't fail the rule nor shows "no changes made". Despite from my side the criteria of the automation are made (Field A definitely changes, and it is shown in the Issue History, and it moves from High to Medium for example), but nothing happens in the automation itself, nor anything is logged, error or otherwise, in the automation audit log.

Will definitely look into your suggestions, and what Trudy has mentioned above too.

Thank you again, much appreciated!

Carl P November 20, 2024

Hi @Bill Sheboy - thank you again for your response it is most useful - and the create lookup table function is something I had not seen before, and it will be great for us.

As mentioned to Trudy - I used the the Change Log in combination with the enabling of "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule." in the Rule Details - as the initial field change of Field A is driven by another automation. Upon doing this I am able to see the logs of the field and what it shows in the backend.

Like # people like this
1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2024

Hello @Carl P 

Welcome to the Atlassian community.

Have you tried using the Log action to write out the values contained in the {{fieldChange}} object, to see what information is available?

I've not tried to get that info for that specific field type before, but that would at least confirm or refute whether or not any useful information was available.

Carl P November 19, 2024

Hi @Trudy Claspill - I actually haven't tried that as yet - will definitely give that a go and see what values come out of it - thank you very much for that suggestion!

Carl P November 20, 2024

Hi @Trudy Claspill - this worked great, thank you - I used it in combination with the enabling of "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule." in the Rule Details - as the initial field change of Field A is driven by another automation.

Like Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events