Hello hive mind!
I've got 0 JSON skills and suspect this is part of what's blocking me :)...
We'd like to do the following:
1. New ticket is created
2. Populate a multi-select custom field with a value matching the project (e.g. if the issue is created in a project called NET, select NET from the field, if the project is DIGI, select DIGI etc)
Currently I'm struggling to work out:
1. How can we read which project the ticket is part of so that we can define this to be the value that's copied down (it doesn't appear to be a default field we can copy a value from)
2. How can I populate the target multi-select field - it doesn't appear to be available. I've found some community posts that indicate the fix is to use the More Options JSON but I can't find any training for coding novices on what to actually put in it.
Hello @Kit Friend
Thanks for writing to us.
I would suggest you to use if/else condition block along with "Issue fields condition".
Trigger: Issue Created
Condition/Action: if -> project equals NET then -> edit issue(choose custom field from drop down ) and for value, select appropriate value from dropdown out of all the multi-select options you have.
else if -> project equals DIGI then -> edit issue(choose custom field from drop down) and select value from dropdown out of all the multi-select options you have.
No need to use advanced json part.
Something like this:
Hope this helps you.
Cheers
Sherry
Hey Sherry - I agree but we wanted to try and avoid having 11 nested IF/else equations and do something a bit more dynamic :P
Is there a tutorial on how to use the JSON option?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kit Friend
Yes you can achieve this using JSON, something like this:
"update": {
"your_custom_multiselect_field_name": [
{
"set": [{"value": "{{issue.project.key}}"}]
}
]
}
}
For more details and usage with examples, you can refer here.
Thanks
Sherry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Sherry,
Almost there I think. I thought this would work:
{
"update": {
"customfield_10054": [{
"set": [{
"{{project.key}}": "{{issue.project.key}}"
}]
}]
}
}
and I can successfully write in the Project Key as a label using a similar technique. But when trying to use it to set the content of customfield_10054 I get:
Error editing issues DEMO-42 (Field 'customfield_10054' cannot appear in both 'fields' and 'update')
Thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can set value like:
"customfield_11448" : [ { "value": "option1" }, { "value": "option2" } ]
or
"customfield_11448" : [ { "id": 10112 }, { "id": 10115 } ]
So either use value or id not "{{project.key}}" inside set .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sherry, that won't fulfil the goal here of setting the field content dependent on what project the trigger ticket is created in though right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me try it once more :)
Say there is custom field "brand" which is multi-select field type. So it's possible values are exactly as all project keys.
Then I can create a global rule where I choose trigger "Issue created" and then edit issue action where I set field "brand" as "project.issue.key".
And above json will do just the same, just set the value of "brand" same as project key, independent of project where issue was created(provided list values are exactly the same and all project keys are covered).
I think this is what exactly you are looking for.
Please correct me if I got you wrong.
Thanks.
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.