Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Script Runner Fast-track post function

Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 26, 2023

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'
So if the users are selecting Another Value along with the 'Other Software' then the post function still triggers.
We want to modify the condition something like this>
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

1 answer

1 accepted

0 votes
Answer accepted
Robert Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 26, 2023

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

Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 27, 2023

Its showing an error for !

Capture.PNG

Robert Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 27, 2023

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

Like Manoj Gangwar likes this
Manoj Gangwar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 27, 2023

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?

Robert Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 27, 2023

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

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events