How to assign a user to custom field when a new ticket is created

Jeet Damania November 14, 2023

I'm trying to create an automation. I would like to assign a specific user to a field that I have created inside a jira form. Can really understand what JSON should be used for this

2 answers

1 vote
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2023

Hi @Jeet Damania,

Welcome to Atlassian Community!

Are you trying to add data to the Request form or Forms (found under Project settings > Forms)? Based on your question it sounds like the latter, and if that is the case the only way to do it would be to link the field in the Form to field in Jira. Your automation would then populate that custom field with the user, re-open and re-submit the Form and that would then sync the Form with the fields that are linked.

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.
November 14, 2023

Thanks, @Mikael Sandberg as I missed the part about the form usage  :^)

Like Mikael Sandberg likes this
Jeet Damania November 14, 2023

its "Context Fields" under project -> project settings -> request types

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2023

Okay, in that case then the KB that @Bill Sheboy linked to would be the way to go. You need to know the Atlassian Id for the user you want to add which you can get if you do a webrequest to the Find users endpoint.

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.
November 14, 2023

Or...if this is the same user for all cases, you can do this to find their account id value one time:

  • perform a JQL search for issues with
    • assignee = type in the user's name
  • Jira will convert that to the account id, and then copy that value to use in your rule
Jeet Damania November 15, 2023

Thanks. Now i keep getting this error 

 

No fields or field values to edit for issues (could be due to some field values not existing in a given project):

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.
November 15, 2023

Please post the following:

  • an image of your complete rule (ideally in one image),
  • an image of the edit issues action, and
  • an image showing the audit log details for the rule execution. 

Those will provide context to help explain the symptom.  Thanks!

Jeet Damania November 15, 2023

an image of your complete rule (ideally in one image),

Screenshot 2023-11-15 at 3.44.04 PM.png

 

an image showing the audit log details for the rule execution. 

Screenshot 2023-11-15 at 3.44.51 PM.png

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.
November 15, 2023

The syntax for your JSON is not quite correct.  (Please note the documentation only shows the details for each field type, and does not repeat the "wrapper" code for each example.)

A full example would be this.  Please add your account id value.

{
"fields" : {
"customfield_10702" : {
"id" : "yourAccountId"
}
}
}
1 vote
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.
November 14, 2023

Hi @Jeet Damania -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

Have you tried to use the Edit Issue action, select your field, and then select the user?

There may not be a need to use advanced edit with JSON, unless your field is not listed in the drop-down list.  In that case, please look here to learn the correct syntax for single-select or multiple-select, user fields...depending on which applies:

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Single-user-picker-custom-field

Please note you will need to use the account id value when using JSON.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events