You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
From Jira Automation, we'd like to pass values back from calling Scriptrunner. (I have various scenarios where I want to do this, the most common of which is to call an external REST API and deal properly with error codes. A4J aborts any automation on receiving a 404.)
Ideally return values established in Scriptrunner are made available to Automation. I want to keep it as Automation's job to edit the issue so it's clear to the casual nocoder what is going on.
Is this possible? I'm on DC.
So it looks like the right way to do this is to define a REST endpoint and call that from a waiting WebHook in Jira Automation. (Kudos to @Tom Hudgins on Need value of automation rule initiator in scriptrunner script for his comment about a workaround.)
Even if there is another way, using REST follows the principles of following an existing standard for communicating between different systems, and keeping things as loosely coupled as possible.
The REST API should be set up to guard for permitted APIs. It could be hosted on AWS Lambda/Forge or ScriptRunner or PowerScripts, depending on how future proof the architecture needs to be.
Of course, it would be nice if Scripting solutions for Jira just wrapped the REST call in quasi parameter and return call semantics. i.e. called REST for us and waits for the answer, passing back values via an unpacked webhook response. As it is, you can invoke only with no sense of instructing behaviour or knowing outcome.
If you only need to call a REST endpoint to setup a webhookResponses smart value list to use in later scripts, you can do a GET web request to http(s)://your.jira.host/status.
This is a very quick call which requires no authentication and avoids the need to set up a separate REST endpoint in scriptrunner.
Seems like the values are set by side effect.
So relying on it could break silently down the road.
That said, I'll play with this - I suspect I passed judgement too quickly.