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

Make check box mandatory

Nikhil Srivastav May 8, 2013

I have a custom field of multiple check boxes , in which i want that one field should remain always select and user will not be able to deselect it. I have below code in groovy code for checking the null values:

CustomField SOPlist = customFieldManager.getCustomFieldObject("customfield_13087");
      def sop = (String[]) issue.getCustomFieldValue(SOPlist);

if(sop ==null ){
              invalidInputException = new com.opensymphony.workflow.InvalidInputException(" field is mandatory");    
            }

For that particular option i have tried using below code:

CustomField mandate = customFieldManager.getCustomFieldObject("customfield_13087-1");
    String madPlugin = (String) issue.getCustomFieldValue(mandate);

But the above is not working throwing the below error:

The script failed : javax.script.ScriptException: javax.script.ScriptException: java.lang.NumberFormatException: For input string: "13087-1"

Please help.

Thanks in advance

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Daniel Reichelt April 27, 2014

Hello Nikhil,

the CustomFieldManager's method called "getCustomFieldObject" excepts a String to be of format

customfield_<customfield_id>

If you try to access the ID "customfield_13087-1" the expected number format won't match the given value.

You should try "getCustomFieldObjects" or "getCustomFieldObjectByName" for your purposes.

TAGS
AUG Leaders

Atlassian Community Events