We have a project R which holds the requirements and a project T which holds the test cases.We now want to change the status of the test case and update a custom field when a certain field of requirement object is changed.How can we do this using scriptrunner listener?
You could create an Automation rule that publishes an event when the custom field is changed on the requirement.
Then create a script listener that listens for that event which executes a transition on the test case.
If you're wondering how to actually execute the transition on the test case, below is an example of a script that I use to do that, although you'll have to have some association between the requirement and the test case in order for this to work.
In the example below, the script triggers when a version is released. It first grabs all of the issues associated with that release and iterates through them to execute the 'Done' transition and adds a comment if it was successful. If it turns out that the issue wasn't already in the Done status but still couldn't execute the transition, it removes the issue from that Release.
There is some extra stuff in the script that you don't have to include (the writeLog functions), but, as long as you can figure out what test cases you're trying to transition, this should get you there.
As a note, I'm running 9.12.4 and I had to update the part of the script where it tries to execute the transition, as the code I was using in 8.20.26 no longer worked after the upgrade.
Thank you very much @Matt Parks .We might need to make some changes as per our requirement. But we now have some starting point.
It looks like you're new here. Sign in or register to get started.