We use a team-managed project (NextGen) in JIRA.
I am trying to create an automation that edits newly created issues: I want certain fields to be copied from the parent epic. My automation works with default fields like assignee and labels because I am able to pick them in the dropdown menu when creating an automation. My user multi-select field is custom and therefore doesn't show up in the dropdown menu when editing an automation. I suppose, I have to use the advanced text box to make it all work the way I need it to.
I've tried searching forums and copy-pasting (and editing cutom field ID or name) code other users have suggested into my automation, but that didn't work. I've also tried reading through JIRA documentation and copy-pasting (and editing custom field ID or name) code from there, but this also didn't work.
The best result I've got is automation saying it worked OK but not actually editing the custom user field. Other times I would either get an error saying 'data was not an array (customfield_10059)' or 'Error while parsing additional fields. Not valid JSON.'
Any help would be greately appreciated, thank you!
Hi @Petr Sigaev
When you say that it is a multi user field and it isn't showing up, is that in the list of fields to edit for the Edit Issue action?
As far as I can see in the code we support multi user fields and it should be showing up. If you look at the JSON response as mentioned above, is the field type
com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker
Cheers,
Simeon.
Hi! Thank you for your response. What I mean by multi-user custom fields not showing up in the automation dropdown menu is that they aren't there for team-managed projects. Let me provide you with an example.
I have a custom user field that supports selecting multiple users here. It's called MultiUserField (this is a test board).
However, when I try to make an automation with it, I can't find it in the Edit Issue dropdown menu as shown on the screenshot below.
I presume, I have to use the advanced text box to edit this field. I am not sure which line of code is needed to accomplish automatic editing of this field based on what's selected in the epic's MultiUserField.
Also, sorry for taking so long to reply to your message. I'm new here and I assumed I will receive a bell notification in JIRA. I didn't realise I have to visit the forums to see I have replies on my question, I just assumed there was no activity and got lost in my day-to-day tasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @pe ,
So they should be there however, custom fields for team managed projects are specific to that project. So it depends on where you're configuring your rule.
If you're in another project it won't show up. It will only show up in that project and global / multi project rules.
If that isn't the case, please raise a support ticket so we can look into it.
Cheers,
Simeon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Simmo thanks! I will raise a support ticket. I am configuring it inside the project, it is a local rule.
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.
Hi @Petr Sigaev
Is your field a cascading select?
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.
Hi @Petr Sigaev,
My apologies mate. I'd forgotten that team managed projects had introduced the People field, which we don't currently support in the UI.
We should be able to get the JSON going here. The underlying field structure is a list/array.
I just spent a bit of time on my dev instance figuring out a smart value for you that will work. My People field is called "ASB People CF" on both my epic and story issues:
{
"fields": {
"ASB People CF": {{issue.epic.ASB People CF.accountId.asJsonObject("accountId").asJsonArray}}
}
}
Now, this smart value will copy across one hierarchy level. That is Epic -> Story/Task.
If you wanted to do Story/Task -> Sub task, change "epic" in the smart value to "parent".
Let me know how you go, but this should work, its just worked for me :)
Apologies again for taking so long to get my head around what was going on!
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.
Hi @Petr Sigaev,
No worries mate! Glad we got there in the end. I do apologise for taking so long to realise what was going on. Glad it works!
Have a good one.
Cheers,
Simmo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Petr Sigaev
If you don't mind using another solution, the add-on Elements Copy & Sync lets you do just that.
I'm the Product Manager of the app, and when creating an issue from an Epic, you can just configure which users you want added to any custom user picker. It looks like this :
With this simple configuration, my two users are automatically set in my custom field "TEST User Multi" when the issue is created.
I hope this help. Don't hesitate to contact our support team for any additional information.
Kind regards,
Julien
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
Thank you for your suggestion.
If all else fails, I will definitely give your plug-in a try. Otherwise, I'd like to stick to built-in tools and not make another plug-in request.
I will, however, keep your suggestion in mind!
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.
Hi @Petr Sigaev
You have to use valid JSON to update the field. Try this.
{
"fields": {
"environment": "Thanks for raising {{issue.key}}.",
"labels": [
"bugfix",
"blitz_test"
],
"customfield_10149": [
{"value": "Option 1"},
{"value": "Option 3"}
]
}
}
If you are not sure about the valid JSON format then take a look at how JSON response looks like for an existing issue with those fields filled in using this end point.
JIRAURL/rest/api/3/issue/sd-26
For complete reference this page is very helpful: https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/
I hope it helps.
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Petr Sigaev -- Welcome to the Atlassian Community!
Adding to what @Ravi Sagar _Sparxsys_ suggests, here are a couple of other references to help:
Best regards,
Bill
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 have suggested successfully edits the labels field and adds specified labels. However, I am still uncertain as to how to edit this code for the custom user field so that it looks up a field in the Epic and edits itself accordingly.
For example, Epic has 3 people in the custom user field: Mark, John, Anna. I want the automation to fill in the custom user field for a child task so that it matches the parent Epic issue. Meaning: Mark, John and Anna are automatically added to the custom user field of the child task.
I can't tell it to always fill in Mark, John and Anna because every Epic has different people attached to it.
Also, sorry for taking so long to reply to your message. I'm new here and I assumed I will receive a bell notification in JIRA. I didn't realise I have to visit the forums to see I have replies on my question, I just assumed there was no activity and got lost in my day-to-day tasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Running automation with this code returns no errors, but the field I want edited remains empty (MultiUserField).
{
"fields": {
"environment": "Thanks for raising {{issue.key}}.",
"labels": [
"bugfix",
"blitz_test"
],
"MultiUserField": [
{"value": "{[issue.parent.epic.MultiUserField.value}}"}
]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried experimenting a little bit. I simply don't get it. I took chunks of code from the official documentation and implemented them into the preset you've provided just to see if they'll work, but I get errors and no fields are getting updated.
{
"fields": {
"environment": "Thanks for raising {{issue.key}}.",
"labels": [
{"value": "{{issue.parent.labels.asJsonStringArray}}"}
],
"MultiUserField": [
{"value": "{{initiator.accountId}}"}
]
}
}
I spent another hour reading through documentation and trying different snippets of code but no luck so far still.
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.