Forums

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

Get Automaton Rule variables in ScriptRunner script

Erik
Contributor
July 29, 2024

Hi y'all, 

I have an automation rule in which I have declared many variables using the “create variable” action. I will run a Scriptrunner script at one point in the Automation Rule. However, it is necessary that I need the variables that I have created using the action in this script.

Is there a way to do this?

Best,
Erik

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Tomasz Kowalczyk
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 31, 2024

Try this one Capture1111.PNG

Tomasz Kowalczyk
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 31, 2024

So in this case you have to change variable name initiator to  {{lookupIssues}} of course

Erik
Contributor
August 1, 2024

Hi Tomasz,
that is exactly it. Thank you!

Erik
Contributor
August 1, 2024

Hi Tomasz,

just a quick follow-up Question.
Is there a way to export a Variable as a SmartValue from Scriptrunner?

Tomasz Kowalczyk
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.
August 1, 2024

But the script is firing as a last thing in your automation where would you like to pass your variable?. I'm not sure but i think there is no way to send a variable as smartvalue. In case you would like to read about it i will leave here link to the adaptavist documentation. https://docs.adaptavist.com/sr4js/latest/integrations/automation-for-jira/execute-a-scriptrunner-script

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 31, 2024

Hi Erik,

Please share a screenshot of your Automation configuration.

Also which ScriptRunner Automation Feature do you intend to use to get the variable?

Thank you and Kind regards,

Ram

Erik
Contributor
July 31, 2024

Hi Ram, 
Thanks for your help!

My Automation Rule is a bit longer. 
The import part is this: 

I am using a "lookup Issue" Action to get a list of Jira Issues.
Therefore Jira is creating the {lookupIssues}} SmartValue / Variable.

I need this variable in a Scriptrunner Script to to process these issues further, since the Number of Issues is always different, which makes it difficult / impossible to map the process via automation. (In short, I want to dynamically create tests)

Also I am using "execute a ScriptRunner script" action for Jira Automation.
If you need more information from me, please feel free to ask!

Best,
Erik

TAGS
AUG Leaders

Atlassian Community Events