I have a custom field called "tester". The custom field is single user type i.e. the checkbox "Restrict to Single User" is set. I want to update value of this field with value of assignee upon a transition.
I have used "Project Setting" -> Automation for this. In this automation, I have used "When: Issue Transitioned" Then "Edit: Issue Fields". In the edit issue "Advanced Option" in additional fields, I have used this JSON
{
"fields": {
"Tester": {{initiator.accountId.asJsonObject("id")}}
}
}
On execution, it is giving error
"Error editing issues
Hello @Girish Hippargi
You don't need to use Advanced Options and JSON for that.
If you want to copy the value of one User Picker (single) field (like Assignee) to another User Picker (single) field you can do that with the Copy option in the Edit action.
That changes the text in the field as shown below. Click on that text and you get a pop-up to select the issue and the field from which you want to copy the value.
Change the Field to copy value from to Assignee.
Thanks for the response @Trudy Claspill But the problem is that I want to copy assignee value into custom single user picker field. But the custom field is not displayed in the "Choose field to set" dropdown
That is why I had no option but to use the "Additional Fields" advance option and json.
Hope my problem is clearly understood now. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you working on an Automation that will apply to a Company Managed project or a Team Managed project?
Can you show us the custom field configuration, so that we can confirm the field name and type?
There is an example of setting a single user picker field (Assignee) in this document:
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/
The example looks like this:
{ "fields": {
"assignee": {
"id": "{{initiator.accountId}}"
}
}
}
In your case if the field you want to set is Tester, and you want to set it to the same person that is currently in the Assignee field, then I believe the correct code would be:
{ "fields": {
"Tester": {
"id": "{{Assignee.accountId}}"
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its a Team-Managed Project. Automation will apply to a Team Managed project.
Field "Tester" Details as screenshot:
I had referred to the documentation and used
{ "fields": {
"assignee": {
"id": "{{initiator.accountId}}"
}
}
}
Was still getting the same error "data was not an array"
I made the change suggested:
{ "fields": {
"Tester": {
"id": "{{Assignee.accountId}}"
}
Still got the same error:
Please suggest.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I provided the answer without testing it, just referencing the documentation. When I tested it myself in a Team Managed project I got the same error your did.
I think I made an error in the code - I left out the issue prefix in the smart value.
{ "fields": {
"Tester": {
"id": "{{issue.Assignee.accountId}}"
}
}
}
But even after I corrected it in my own system I got the same error that you did data was not an array.
I've tried some variations but keep getting the same error.
The same methodology works fine in a Company Managed project.
I have not yet found any references that this should be done differently in a Team Managed project.
I'm going to do something that I really don't like to do often, and tag another community member that has demonstrated a high level of expertise in this specific area (Automation). @Bill Sheboy can you assist with this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Girish Hippargi and @Trudy Claspill
The People-type field in Team-managed project (TMP) have some challenges in rules...and this appears to be one I did not know:
They appear to be multiple-select behind the scenes and that checkbox for "Restrict to single user" only impacts entry on the issue views. I confirmed this by looking at the data with this how-to article to see the stored structure of the issue data: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
To solve your need, please use the JSON format for a multiple-select field with the custom field ID for your field, and only supply one value in the array:
{
"fields": {
"customfield_12345": [
{ "id": "{{issue.assignee.accountId}}" }
]
}
}
I tested to confirm it works.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You @Bill Sheboy
The solution worked.
How can we have the atlassian documentation updated ? or the issue fixed?
Thanks @Trudy Claspill for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
Regarding documentation, I recommend posting feedback on the documentation pages and from the automation rule editor. Many of the differences for TMP versus CMP are subtle; some are not ;^) Giving feedback on what we find will help Atlassian understand the impact to customers and so guide improvements.
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.