You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.