I'm asking for your help to create a script for Adaptavist ScriptRunner, which will perform the transition of statuses in the workflow. I ask those of you who have experience and knowledge in writing scripts. I'm new to this and don't know how to do it.
I need a script that will perform the transition between statuses in a workflow (it should execute for all projects in Jira). The logic is as follows:
WHEN Comment added -> IF Issue matches Status = "A”; Comment is public; User is an agent; Comment is primary action -> THEN Transition issue “A1”
ELSE IF Issue matches Status = "B”; Comment is public; User is not an agent; Comment is primary action -> THEN Transition issue “B1”
ELSE IF Issue matches Status = "C”; Comment is public; User is an agent; Comment is primary action -> THEN Transition issue “A1”
Maybe some of you already have similar templates. I will appreciate your help very much.
PS. I know that such automation rule can be created with standard Jira tools, but I have a hidden transition in a workflow that can be triggered from other applications (e.g. ScriptRunner).
Here's how to do a transition in a listener that listens for all comments - https://library.adaptavist.com/entity/transition-an-issue-when-a-tm4j-test-execution-is-updated - it's for test management and only does one transition, but all you'll need to do is change the logic so that it can trigger A1 or B1 instead conditionally instead of always trigger the same one.