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
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().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tom Hudgins
Are these the smart values you need for the Initiator who triggered the rule?
{{initiator.displayName}}
{{initiator.emailAddress}}
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha... You may want to search the developer forum to see if someone has solved this there: https://community.developer.atlassian.com/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.