Forums

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

How get the previous value from principal field with smart values in automation rule?

Angel
Contributor
April 30, 2025

Hi

When the principal changes, how would I get the previous value? We need because in automation rules we need update the previous principal issue.

Regards

1 answer

1 accepted

3 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.
April 30, 2025

Hi @Angel 

For a question like this, context is important for the community to help.  Please post the following:

  • what version of Jira are you using: Cloud, Server, or Data Center
  • for Cloud, what type of project is this: company-managed, team-managed, JPD, etc.
  • an image of your complete automation rule in a single image for continuity
  • images of any relevant actions / conditions / branches
  • an image of the audit log details showing the rule execution
  • explain what is not working as expected and why you believe that to be the case

Until we see those...

 

Is "principal" a custom field in your Jira project?

If so and your rule is triggered on a change to the field, the {{changelog}} smart value will help find the previous value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog--

If instead you want the previous value with any other rule trigger, you will need to either:

  • use two rules and an additional custom field: the first rule saves the value whenever it changes and your second rule uses the saved previous value
  • or, call the REST API endpoint with the Send Web Request action to read and parse the change history to find the previous value

 

Kind regards,
Bill

Angel
Contributor
April 30, 2025

Hi @Bill Sheboy 

We have Jira/Cloud, in branch with principal issue (parent) a use a lookup with query that search by "parent = {{key}}" for create a list of secondary issues in the parent issue. But when a secondary issue is removed I need update this list in the parent issue so I need the previous parent key to create my query, or maybe is possible create a query that get the list of secondary issues? 

I said "secondary issues" because that arent sub-task issues, we have premium plan so we create others levels.

branch.png

 

 

 

 

 

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.
April 30, 2025

Thank you, and I believe I understand the scenario: when the parent of an issue is removed (or changed) you want to update the previous parent's fields

Is your rule triggered on a change to the parent field?  If so, the {{fieldChange}} smart value will help: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

For example, to access the previous parent's issue use a branch on JQL.  You may add another branch for the current value of the parent field, if needed

  • trigger: field value changes for parent
  • branch: on JQL of  key = {{fieldChange.fromString}}
    • action: lookup issues, with your JQL to access the previous parent
      • parent = {{issue.key}} AND issueType = Proyecto
    • action: some action using the lookup issues results...

 

UPDATED: I re-tested this and the {{changelog}} smart value no longer works with the parent field.  Please use the {{fieldChange}} one instead.  I have updated the above suggestion.

 

Like Angel likes this
Angel
Contributor
April 30, 2025

Thanks @Bill Sheboy thats works. 

Like Bill Sheboy likes this
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.
May 1, 2025

I am glad to learn that helped!

One more thing to consider: what happens if the previous value is empty?  That can be handled by adding a Smart Values Condition before the branching attempt.

Suggest an answer

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

Atlassian Community Events