Hi,
I would like to use a simple "OR" in the condition of the Script Post-Function Create a sub-task (Scriptrunner):
('Value1' in cfValues['CustomFieldName']*.value || 'Value2' in cfValues['CustomFieldName']*.value)
But it does not work...
This one works: 'Value1' in cfValues['CustomFieldName']*.value
I am using this Post-Function in a workflow on the Create transition.
Thank you for your Help !
Camille
Hi Camille!
What type is the CustomFieldName? Different custom field types return different values. For example, if CustomFieldName is a plain text field, using 'in' and '*.value' returns a list of strings and will only check if your value is in the list.
For example: "The quick brown fox jumps over the lazy dog"*.value returns :
[T, h, e, , q, u, i, c, k, , b, r, o, w, n, , f, o, x, , j, u, m, p, s, , o, v, e, r, , t, h, e, , l, a, z, y, , d, o, g, .]
The way that you have the code typed, your 'CustomFieldName' will probably need to be a type like MultiSelect.
Hi Carmen !
The customfield is a Checkbox. Is there a solution for that type of field please ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code you published in the original query works with a Checkbox for me! If you can, post a screenshot of the actual code you have in the script. That way, I can try to recreate the error. If you can provide the execution history of the Post function, that could also be helpful as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found my error. The correct syntax for my checkbox customfield was that one :
(cfValues['CustomFieldName']*.value.contains("Value1") || cfValues['CustomFieldName']*.value.contains("Value2"))
Thank you Carmen this was indeed a matter of customfield type !
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.