How to show some validation error to User using behaviors plugin

shashank vivek December 2, 2015

This is what I have written in validation script of Behaviors Plugin of jira

FormField  srcd = getFieldByName("SIS Tech Review Completion Date")
FormField  srsd = getFieldByName("SIS Tech Review Start Date")
String compdate = srcd.getValue()
String startDate = srsd.getValue()
if (compdate < startDate){
    srcd.setError("error") 
}

Once I put "compdate < startDate" in JIRA field of the ticket , suddenly JIRA field becomes non-editable. I am not sure how can I inform User about this validation with message :

"SIS Tech Review Completion Date should be greater than SIS Tech Review Start Date"

 

2 answers

0 votes
Jamie Echlin _ScriptRunner - The Adaptavist Group_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
December 2, 2015

It looks ok to me, but you need to clear the error once that condition is not true. It doesn't happen by magic. 

So you need an else block with srcd.clearError() or whatever, can't remember syntax right now. 

If that doesn't help can you add some screenshots.

0 votes
Steve Behnke [DiscoverEquip.com]
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.
December 2, 2015

Is there any reason you aren't using a workflow validator to accomplish this?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events