Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira automation set variable

Maurice Stassen
Contributor
July 9, 2024

I want to set a variable with a specific user account id.
So i can make all my further checks on this variable instead of getting the user every check.
This is handy when copying the automation rule for another user...

1 answer

1 accepted

1 vote
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.
July 9, 2024

Hi @Maurice Stassen 

You could try the Create Variable action to do that: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Create-variable

There are some limitations on when / where a value can be set and later used in a rule.

And so if using that action does not help, please post images of your complete rule and the audit log details showing the rule execution.  Those will provide context for the community to offer suggestions.  Thanks!

Kind regards,
Bill

Maurice Stassen
Contributor
July 9, 2024

Yes i know that (how to create variable).
But i want to put in in a User/Account ID into this variable.

How can i do that?

AccountID.png

ALAA EDDINE ROUCADI July 10, 2024 edited

Hi @Maurice Stassen ,

You might want to use user smart values as explained here: Convert usernames to account IDs 

Regards,

Maurice Stassen
Contributor
July 10, 2024

So this is valid?

{{AccountTemp}} = 1234567890

 

(assuming 1234567890 is a valid accountid within my jira environment)

ALAA EDDINE ROUCADI July 10, 2024

If you need to use the account ID through a defined variable named AccountTemp, you can use the account ID value by referencing {{AccountTemp}} in the rest of the automation, within the variable's scope, of course.

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.
July 10, 2024

Hi @Maurice Stassen 

The example you show will correctly set the variable, and then it can usually be referenced later in the rule as:

{{AccountIDToCheck}}

Please note I added "usually be referenced"...Some rule syntax cannot use variables, or it is challenging to do so.

This is why I asked to see your entire automation rule, for context.  For example:

  • Where in the rule is the variable defined within the rule?  If a variable is defined within some rule blocks, such as branches, it will not be available outside of the branch, or even to other loops of the same branch.
  • How are you trying to use that variable in the rule?  If it is for a comparison, you might try the smart value condition.
  • If you are trying to use that variable in a function within a smart value expression, that might not work.  It depends upon the specific function and the context within the rule.
  • etc.

Thanks!

Like • Maurice Stassen likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events