Hello All,
Currently, I am using the below condition to transition the issue to next status but the field which we have is a multi-select field.
cfValues['Enterprise Software']*.value != 'Other Software'
cfValues['Enterprise Software']*.value contains none of 'Other Software'
So, if we select two values in the multi-select field like-
Value in (Other Software, New Software) then condition should be false.
If value = Other Software then False
Else True
Hi @Manoj Gangwar ,
Your query should be:
'Other Software' !in cfValues['Enterprise Software']*.value
Could you give this a go and let me know how you get on?
Kind regards,
Bobby
Its showing an error for !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This must be because you are on a fairly older version of ScriptRunner. The !in operator was added as part of the Groovy upgrade with release v7 of ScriptRunner:
https://docs.adaptavist.com/sr4js/latest/release-notes/release-7-x#groovy-3-update
With an older version of ScriptRunner, you can instead use this query:
!(cfValues['Enterprise Software']*.value).contains('Other Software')
However, I would always recommend looking to upgrade ScriptRunner when you can, there are a significant amount of upgrades for you to be able to take advantage of, one of the most significant being HAPI:
https://www.scriptrunnerhq.com/hapi
Kind regards,
Bobby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the quick resolution. We have a planned upgrade of Jira and Plugins.
It works now as expected.
One more thing I want to run this Post function as a User = 'JSM User' but currently its running as a Default user and there is no option to change in in UI. Could you please suggest the script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Currently using the Built-in Fast track Post Function there is no way for you to define the user who performs this action.
Instead, what you would have to do it write a custom scripted Post Function. Is this script you can perform the same action (check the custom field doesn't include Other Software, and if it doesn't, transition the issue to another status) however, as you are writing a custom script using the Java API, you should be able to change the user who performs this action in the code.
Your feedback is really useful though, and I will be sure to get this back to the product team.
Thank you!
Bobby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @robert
you mention that you can transition the issue in the custom script post-function.
Can you please let me know some example on how to do that?
When I try to do that in a listener, if is often resulting in some kind of a race condition (status changed according to the logs, but status value is still the old value).
Is this different in post-functions? And if so, do you know, why this is the case?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Stefan Stadler ,
Sure! You can find an example of how to transition an Issue in ScriptRunner for Jira Cloud here!
As for the issue you are facing, I am not 100% sure on the cause for that, as I don't have a full understanding of the chain of events from the Jira side. It could be the case that when you transition an issue, the event is fired to ScriptRunner and the Listener executes, but if you have a large number of post functions it could delay the update of the transition on the Jira side? But honestly I am guessing.
However, having the script execute as a post function (and thus part of the transition) should solve this issue.
Thanks,
Bobby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.