Transition Validator Explanations

Deleted user October 10, 2018

I see sample scripts are available, but I can't seem to find a detailed explanation of those scripts.  I've tried using Google and a search on this site, but am not finding something that describes what everything means.

I want to create a transition validator on a checkbox that prevents moving to the next step if the box is checked (YES).  I used one of the examples, but the popup isn't the message I entered, although it did stop the transition...regardless of whether the box was checked or not  Obviously, I'm not understanding the samples, so am looking for a detailed explanation.

Thank you for pointing me to information that will educate me!

2 answers

1 accepted

1 vote
Answer accepted
Yogesh Mude
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.
October 10, 2018

HI @[deleted]

You can find the multiple examples on Simple script here.

Deleted user October 10, 2018

Thank you, Yogesh!  I did find that site with my Google search, but it jumped me directly to the Validator section, so I didn't realize that it contained detailed script explanations.  I will go through the full site and let you know if that solved the problem.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Hello @[deleted]

Just to add to @Yogesh Mude answer, writing custom validator is also pretty straightforward, please see sample here

https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/require-fix-version-if-fixed.html

Deleted user October 10, 2018

Thank you, @Tarun Sapra.  I've been going through that site with a fine-tooth comb, but am having no luck finding out why my simple validator isn't working.  All I want to do is stop from moving to the next step if a check box is checked (Yes).  I am currently using: cfValues['Re-invoice Needed']*.value.contains("Yes").

I also tried it with cfValues['Re-invoice Needed']*.value.contains(" ") and cfValues['Re-invoice Needed']*.value.contains("") as the error message says it will provided to the user if the condition is not true (and I don't have "No" as an option).

Before I went to Adaptavist's site, I used a different sample script that stopped it whether the box was checked or not.  Now it's letting it proceed whether the box is checked or not.  

I think I need more caffeine...

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Hello @[deleted]

What are the options of your checkbox custom field just Yes or No , or something else?

Deleted user October 10, 2018

@Tarun SapraJust unchecked or checked (Yes), defaulting to unchecked.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

@[deleted] can you please share screenshot of the custom field.

Deleted user October 10, 2018

@Tarun SapraHere are screenshots from the custom field screen, and then the configure and edit screens.  I am able to create an issue with it both checked and unchecked, so it appears to be working as a checkbox.  Check Box1.jpgCheckbox2.jpgCheckbox3.jpg

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Hello @[deleted]

You said previously that

 All I want to do is stop from moving to the next step if a check box is checked (Yes).  I am currently using: cfValues['Re-invoice Needed']*.value.contains("Yes").

So basically if the value is Yes then you don't want to proceed, is that true? then in that case you can try the following (notice the NOT operator in the beginning) 

!cfValues['Re-invoice Needed']*.value.contains("Yes")

 

Deleted user October 10, 2018

@Tarun Sapra I was very excited and updated the script to include the ! at the beginning.  However, it stops it at both a checked and unchecked box and doesn't give me the error message I defined.  It's a different script, but I'm back to what I had when I first posted. 

You're going above and beyond trying to help me, and I sincerely appreciate it!

Results1.jpg

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Can you change the script to

!cfValues['Re-invoice Needed']*.value

Now it should stop from going ahead if there is any value (in your case there is only one value "Yes") and if nothing is selected then you should move ahead.

Deleted user October 10, 2018

@Tarun Sapra That fixed the  issue with the unchecked box and it moved forward as needed.  YAY!

The issue with the box checked was stopped (Yay!), but it's not giving me the error message I entered.

The validator edit screen says  that "The error message that will be provided to the user if the condition is not true" and a check mark (Yes) should mean it's not true, correct?  So I'm not sure what else I need to do to get my message to appear (which tells them to uncheck the box once the invoice has been re-issued) rather than the "You've performed an illegal workflow operation" message.  I don't want my team to think the workflow police are going to get them.  :-)

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

Glad to know that it fixed the issue, please accept/upvote the answer so that others are helped, if you want custom error message then go for custom validators as explained here

https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/require-fix-version-if-fixed.html

Here you can input the error message in the exception which you want.

Deleted user October 10, 2018

@Tarun Sapra I didn't mean to say I was using a custom error message.  I'm just using the message on the validator screen.  However, I thank you for all the time and effort you've spent on helping me.  I will continue to work on the error message.  =)

Error Message.jpg

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events