Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

script validator - custom field value

arild marthinussen September 17, 2013

Hi I wan't to add a validator to a transition. Users should not be allowed to pass transition (next status in workflow), unless customvalue field 'DeployedBy" has a value, and user should get a message saying "DeployedBy field must have a value'

I've tried adding validator on the transition

cfValues['DeployedBy'] != 'EMPTY' with errormessage "DeployedBy field must have a value"
Gives no result - pass through the transition even if deployedby is empty, or has a value - no errormsg

cfValues['DeployedBy'] == 'EMPTY' with errormessage "DeployedBy field must have a value"

Throws the errormessage every time, both when DeployedBy field is empty, or has a value

Any ideas ???

3 answers

1 accepted

6 votes
Answer accepted
JamieA
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.
September 17, 2013

I feel like I should make a t-shirt saying: "What kind of field is it?"

But to check it has some value, you can just use:

cfValues['DeployedBy']

You don't need to compare with the empty string... if it's empty it will be null. Use built-in scripts -> Condition Tester, and asserts (see docs).

0 votes
arild marthinussen September 18, 2013

:-) , 1 mill thanks :-) - it works

0 votes
RambanamP
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.
September 17, 2013

try something like this cfValues['DeployedBy'] == ''

you can check here for script runner validator sample codes

https://jamieechlin.atlassian.net/wiki/display/GRV/Validators

another way is you can use field required validator from JSU plugin(free)

https://jsutil.atlassian.net/wiki/display/JSUTIL/JIRA+Suite+Utilities+Workflow+Validators#JIRASuiteUtilitiesWorkflowValidators-FieldsRequiredValidator

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events