Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,374
Community Members
 
Community Events
175
Community Groups

Setting a multi-select field based on the parent Jira Project on ticket creation

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.


Screenshot 2020-09-22 at 19.28.13.png

1 answer

0 votes
Sherry Goyal Atlassian Team Sep 22, 2020

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  Screen Shot 2020-09-23 at 10.45.52 am.png) 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:

Screen Shot 2020-09-23 at 10.44.55 am.png

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?

Sherry Goyal Atlassian Team Sep 23, 2020

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 

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 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 .

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?

Sherry Goyal Atlassian Team Sep 23, 2020

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.

Like Vikrant Yadav likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events