Project Automation - Smart Value Assignee

Michelle Gronwold July 17, 2020

Hello - I am setting up a Project Automation Rule to assign the issue to a custom field.

I have a custom field called Team Lead as a User Picker (single user).

I set up the Automation to Assign the issue to the custom field using Smart value. But when I run the rule the Assignee changes to unassigned.

Automation Setup.pngissue created.png

Audit Log.png

1 answer

1 accepted

1 vote
Answer accepted
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2020

{{issue.CustomField.16073}} does not seem like the correct syntax - https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

 

Can you try one of:

{{issue.Team Lead.name}}
{{issue.customfield_16073.name}}
Michelle Gronwold July 17, 2020

Yes! That worked! Thank you!

Janine Crawford February 15, 2021

@radek 

I could really use a second pair of eyes and some advice please.

I have tried a number of different ways to achieve exactly what you list above, but each time the assignee field remains unassigned, despite the audit log showing success in the first case and error in the second, with the following notes:

1) issue already assigned to user

- configuration:

Assign issue > Smart Value > {{issue.customfield_10926.key}}

Assign issue > Smart Value > {{issue.customfield_10926.name}}

2) Error assigning issues CC-33: (Specified user does not exist or you do not have required permissions)

Assign issue > Smart Value > {{issue.customfield_10926}}

Assign issue > Smart Value > {{issue.customfield_10926.displayName}}

 

I've even tried the advanced route with JSON, and using variations of the above, with no success, the assignee field remains unassigned and the audit log shows issues edited successfully:

{
"fields": {
"assignee": { "name": "{{issue.customfield_10926}}"}
}
}

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2021

@Janine Crawford 

 

Can you attach a screenshot of the user you're trying to assign to from /rest/api/latest/user?username=USERNAME

 

I'm thinking that the Assignee field is not actually using username (as I previously suggested), but rather should accept userkey instead. At least that's how it works with Java, so I suspect that might be the same case here (couldn't find it in documentation at the time).

So I am thinking that if the userkey and username are different for that user, then it might actually be {{issue.customfield_10926.key}}

 

If you are in fact on Cloud and not on Server/DC, then I cannot at all vouch for any automation there, I'm not familiar with Cloud to that extent. (Although https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/ might point you there).

 

Just to rule out the basics, are you also sure that the user you assign to has "browse project" and "assignable user" permissions and that the acting user of the automation can actually assign an issue to it? (The latter should throw a warning during automation editing in case of missing permissions, but to ask in any case.)

To rule out whether there are any missing permissions outside of the automation itself can you do everything under the user manually? So we know for sure that we have to focus on the automation configuration.

 

Other than that the first 2 examples you showed should work I think, the "key" one being "probably" the correct way to do it:

Assign issue > Smart Value > {{issue.customfield_10926.key}}

Assign issue > Smart Value > {{issue.customfield_10926.name}}

 

So unless it's permission related, or the issue cannot be modified, I'm generally out of ideas.

There is also a short delay before the automation actually triggers/completes (unless you enforce it in the settings) - for the "success" one have you refreshed the issue after a bit if it finished later?

Janine Crawford February 15, 2021

Hi @Radek Dostál ,

Excuse my ignorance, I am doing all of this through the UI, no API integration.

How do I check the user with the URI you've provided:  /rest/api/latest/user?username=USERNAME. What are you expecting to see?

And yes, this is Cloud based and a Next Gen project, which I've found to be... interesting...

I am also a project admin, so I would assume I have the required permissions. I can edit the issue without any problems, I can set both user fields manually.

Thanks so much for your feedback, it is appreciated.

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2021

This I meant as {{jiraurl}}/rest/api/latest/user?username=<username> but this will not work on Cloud, because Cloud straight up changed to "accountId".

 

Regardless of above, Cloud does not use key/name for user pickers.

As far as I can tell from the cloud documentation https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json

 

You would update a field using "id" value in json, so e.g. "assignee" : { "id": "<accountId>"}

"customfield_11453" : { "id":"2s1863211f0z284c45269423" },

 

And you should be able to obtain the correct accountId from the custom field as 

{{issue.customfield_10926.accountId}}

 

Which theoretically should allow setting an assignee value as

Assign issue > Smart Value > {{issue.customfield_10926.accountId}}

 

Again though Cloud is not my area so I cannot really suggest anything but the accountId seems like the way to go there.

Like Tim Duke likes this
Janine Crawford February 15, 2021

Certainly a value I hadn't tried yet! That worked.

 

Thank you very very much.

 

To clarify, I used {{issue.customfield_xxxxxx.accountId}} as the smart value for "assign issue to" automation.

Like Tim Duke likes this

Suggest an answer

Log in or Sign up to answer