I have a list of Select List type custom fields in which I need to set "Not Required" as default Value while doing "Generate CheckList" step in workflow.
myIssue.setCustomFieldValue(cf, "Not required") -cf is a Select List type custom field.
This kind of code upto JIRA 4.2 version.Now I get ClassCastException.
Can anyone help to setCustomField Value for Select List Type.
Select lists store "option" objects, not "strings". You need to find the "Not Required" option in the list of options, and pass that in instead of the string, or create the option from the string as you go.
Thanks Nic.It works after I pass it as Option instead of String.
Now I need to itertate thruough a set of Custom Fields and setCustomFieldValue.It could be a combination fo text,select list etc.
How to check the type of Custom Field and do setCustomFieldValue accordingly.
Can you please give some examples?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I missed the comment. I don't know if there's an approved way to do it, but I simply get the class name of the object I get back and execute a set of "if" to handle each possible type. Feels clumsy to me, but I've never had time to look for something better.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the custom fields expect different values I don't see any alternative...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to try something like this
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.crowd.embedded.api.User MutableIssue issue = issue ComponentManager componentManager = ComponentManager.getInstance() CustomFieldManager customFieldManager = componentManager.getCustomFieldManager() CustomField customField = customFieldManager.getCustomFieldObjectByName("Overall Impact") Option fieldVal =(Option) issue.getCustomFieldValue(customField) if((fieldVal.getValue()).equals("Low")){ }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
cfValues['Overall Impact'].value == 'LOW'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
cfValues['Overall Impact'] == 'LOW' .
This works good now.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jamie ,
cfValues['Overall Impact'].value == 'LOW' also didnt work out.
Nic,
It is simple scripted validator.Iam trying to chk if Over All Impact has been set to LOW,then validating it for some more conditions.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it does work. Go to Admin -> Condition Tester and do:
assert cfValues['Overall Impact'].value == 'LOW'
then paste back here the output in red as a comment. Choose an issue where that should evaluate to true.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic,
cfValues['Overall Impact'] == 'LOW'
I couldnt see any issue in this line.But Workflow is not recognizing this value though 'Overall Impact' is set as LOW.Please help (JIRA version is 5.2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid I don't understand that. I don't know what you're trying to do, or why you mention workflow when you're looking at a field option.
Could you tell us where you're trying to use thi?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.