How can I create an automation that changes a field's value wrt a change in another field?

Bartu Üstün May 23, 2024

Hello everyone, I have a custom field made called Score. The field Score only has numerical values from 1 to 10. I also have a field called R.Status which has a text field.

I want to create an automation that activates when the value in the field Score changes. If the value (in Score) increases, I need the automation to change the value in the field R.Status to "Increased", and vice versa. Are there any ways to do this?  

Example

Old: Score = 5 and R.Status = Stable

then

New: Score: 7 ---> R.Status = Increased

2 answers

0 votes
Kalyan Sattaluri
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.
May 23, 2024

Hello @Bartu Üstün 

You could use {{fieldChange}} smart values to compare old and new.

From above link:

  • {{fieldChange.from}} - Returns the previous raw value of a field, i.e. the JSON representation of the value.

  • {{fieldChange.to}} Returns the new raw value of a field, i.e. the JSON representation of the value.

But do note that this smart value does not work for certain fields. SO you need to confirm that they work.

I am sharing steps to first you  log these values to see if you are seeing the old/new values.

  • Trigger = Field Value change -> Choose field Score
  • Then Add new Action - Log Statement -> {{fieldChange.from}}
  • Then Add new Action - Log Statement -> {{fieldChange.to}}

Run the rule by changing the field "score" value and checking if you are seeing the old/new values.  Do go further than above unless you verify.

If above looks good, you can continue with:

  • Add new component -> If Condition -> Smart value check:
    • {{fieldChange.to}}
    • greater than
    • {{fieldChange.from}}
  • Then Action -> edit issue

Please share screenshots if stuck. Hope ite helps. Thanks!

Bartu Üstün May 24, 2024

Thank you!!

Like John Funk likes this
Bartu Üstün May 26, 2024

Hey man, I couldn't make this work. When the value in the field changes, nothing happens (automation doesn't work). Shouldn't I specify the field's name while writing the code? For example, shouldn't it be {{fieldChange.Risk Score.to}} or {{fieldChange.RiskScore.to}} instead?

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 27, 2024

Is your rule based on Field Value Changed (Risk Score)? If so, then it should work as Kalyan has described. Can you share your rule? 

0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2024

Hi @Bartu Üstün , welcome to the community.

So in order for automation to achieve this, it needs to have access to the previous value and the new value. The new value obviously will be in the existing custom field score, however, the old value is gone. You could have two custom fields "current score" and "previous score". By doing this, then automation can compare the two values and thereby achieve your requirement. 

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2024

if that solution is something you are interested in and need assistance figuring out the details, please do let me know if you get stuck.

Bartu Üstün May 24, 2024

Thank you man!!

Like John Funk likes this

Suggest an answer

Log in or Sign up to answer