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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need value of automation rule initiator in scriptrunner script

Hi,

I'm using Automation for Jira to run a Scriptrunner script. I need the value of the "initiator" of the rule in my script and I don't see a way to get it. One of the binding variables is currentUser but that is the Actor defined in the rule, not the person who actually triggered the automation rule. 

Ultimately, I'm trying to send an email to the initiator. I can use the Send Email action and put "Initiator" in the To field and that works but I need to do some funky processing to build the body of the email - hence the need for a script to actually send the email. I can build and send an email in a script but I don't have the initiator to send it to. 

(Man, I really wish we could pass values to, and get values back from, scripts in automation rules.) Anyway, is there a solution for this problem?

Thanks 

3 answers

1 accepted

0 votes
Answer accepted

So, it turns out that in version 6.16 of Scriptrunner, they added initiator as a binding variable. 

Interestingly, they also deprecated errorCollection and gave us addMessage() and addError().

Hi @Tom Hudgins 

Are these the smart values you need for the Initiator who triggered the rule?

{{initiator.displayName}}
{{initiator.emailAddress}}

Best regards,

Bill

Hi Bill,

Those are the smart values but I need access to them in a Scriptrunner script - not in the automation rule itself. I basically need some way to pass them to the script.

I do have a kind of workaround for this - passing values to and from a script in an automation rule. I'm playing around with using the Send Web Request action to talk to a Scriptrunner REST endpoint. I can pass data to it in the REST call and get data back in the {{webhookResponse.body}} smart value. 

The only small snag in this approach is the need to bake authentication information in the REST call. 

Tom

Gotcha... You may want to search the developer forum to see if someone has solved this there: https://community.developer.atlassian.com/

0 votes

I'm 80% sure that the smart values are not populated as binding variables. To be 100% sure, ask Adaptavist, developers of ScriptRunner.

(Some weeks ago we tried the same thing that you're trying, and couldn't find an answer.)

Thanks,

Yes, I did post a question to Adaptavist but figured I'd check here as well - they often refer me to here when they don't have a solution.

I'm pretty pleased with the solution of using the web request action to interact with a Scriptrunner script described in my previous response above. We have a service account that I'm using to authenticate so that solves that problem (mostly).

Tom

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.11
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

1,234 views 18 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you