I'm struggling to find the correct condition syntax to make my script listener run. I just want it to run based off a custom field but I can't figure out what the syntax should look like. This is what the custom field looks like in a json if that helps.
I want the condition to be whenever the value is 'IO-TOOLS'. Right now I have the condition as issue.customfield_11623.value == 'IO-TOOLS' but it throws the error
2022-11-25 17:07:43.595 ERROR - The condition: issue.customfield_11623.value == 'IO-TOOLS' evaluated to: ["Evaluation failed: \"issue.customfield_11623.value\" - Unrecognized property of `issue.customfield_11623`: \"value\" ('value'). Available properties of type 'List' are: 'concat', 'every', 'filter', 'flatMap', 'flatten', 'includes', 'indexOf', 'join', 'length', 'map', 'reduce', 'slice', 'some', 'sort'"]
Any help would be appreciated!
It's the == that is the problem. Customfield_11623 is probably a select type field of some sort, so when you use .value to get the contents, you are getting a list object, not a string, and you can't compare lists with strings.
You need to delve a bit deeper and open up the list. I think you need .value.includes to unpack the list and compare what the objects in at with "io-tools"
I changed the condition to issue.customfield_11623.includes('IO-TOOLS') and it seems to run that with no errors, but it never evaluates to true even when I try it with test tickets set to that value.
To help with my testing is there a way to print the payload on the condition each time it runs?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved thanks! Solution was value inside the 0th index and I cant believe I hadn't tried that. For anyone else having this issue it looked like
issue.customfield_11623[0].value == 'IO-TOOLS'
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.