Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign user to custom people field

Julez March 9, 2022
{
"fields": {
"QC": {{assignee.key.asJsonObjectArray("id")}}
}
}

is what I currently have and thanks to the increbibly lacking documentation I can't figure out how to store the current assignee in a custom people field.

This is a People field added to all issue types which isn't Reporter or Assignee and it has no default users and the Tickbox for `Restrict to a single user` is not turned on.

Please help 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
March 9, 2022

Hi @Julez 

The assignee has the "accountId" attribute and the user field set is looking for "id".  So a work-around is to grab the field that is there, convert to the array, and then substitute the attribute name.  Perhaps like this:

{{assignee.asJsonObjectArray("accountId").replaceAll("accountId", "id")}}

Kind regards,
Bill

Julez March 10, 2022

Thanks Bill

I still get the very helpful

Error while parsing additional fields. Not valid JSON.

when using that code.

The only code I have in the advanced field is

{
"fields": {
"QC": {{assignee.asJsonObjectArray("accountId").replaceAll("accountId", "id")}}
}
}
Bill Sheboy
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.
March 11, 2022

Sorry, I was clearly thinking of something else when I first answered...assignee is not a list (and so does not use array functions). This is better:

{
"fields": {
"QC": { "id": "{{issue.assignee.accountId}}" }
}
}
Julez March 16, 2022

Thanks for your help Bill. 

The correct syntax turned out to be:

{
"fields": {
"QC": [{ "id": "{{issue.assignee.accountId}}" }]
}
}

I can't believe how incredibly ill-documented these advanced features are. We just need a wiki.

Like Bill Sheboy likes this
Bill Sheboy
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.
March 17, 2022

I submitted a suggestion to make the smart value/automation documentation much more like the one for the REST APIs, with everything on one page, context indicators (by product: Cloud, Server/DataCenter, JSM, Admin), examples that can be downloaded and imported, and links to KB articles for known gotchas.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events