Forums

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

Invalid field error in global rule for custom field

Phil Bustin May 24, 2022

Inconveniently, the error doesn't appear until I click the exclamation point in the rule summary, or edit the rule, after publishing the rule.  The JSON is:

{
"fields": {
"Business Analyst Signoff": { "id": "{{initiator.accountId}}" }
}
}

The error is:

Additional fields contains invalid field(s) in 'update' or 'fields' section: Business Analyst Signoff

1 answer

1 accepted

1 vote
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.
May 24, 2022

Hi @Phil Bustin 

Smart values are case and spacing-sensitive, so did you confirm you have the correct name for that field?  You can check that using an example issue with the field and this how-to: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

You could also try using the custom field ID name for the field.

Next...you do not show your entire rule for context, so I wonder if the {{issue}} at that location in the rule it has that field?  For example, if you are inside of a branch perhaps it could be referencing a different issue type.

Kind regards,
Bill

Phil Bustin May 24, 2022

I'm sure the field name is correct. 

So far, I don't understand what to do with the information provided when I click the link.

I don't know how to use the custom field ID name.

The field appears in the issue.

Here is the entire rule:

Rule error.jpg

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.
May 24, 2022

I'll try to clarify...

Using your Jira URL in a browser and an example issue, you can find all of the supported fields/smart values for your issue.  For example:

myJiraCloudUrl/rest/api/2/issue/myIssueKey?expand=names

Search in the results on the page for your field name to confirm the spelling, capitalization, and spacing of the smart value's name.

If that looks the same as what you already tried, you can also find the custom field ID on the page and use that in the JSON, as described here.

{
"fields": {
"customfield_12345": { "id": "{{initiator.accountId}}" }
}
}
Like Ian O'LEARY likes this
Phil Bustin May 25, 2022

The rule was accepted using customfield (why not field name?), but the rule execution log showed:

   Action details:
   Edit issue
   Error editing issues
   ASTWFR-8 (data was not an array (customfield_10062))

Again, Business Analyst Signoff is a User Picker (single user) field.  Is { "id": "{{initiator.accountId}}" } the name of the user who selected the transition?

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.
May 25, 2022

Would you please post an image of the edit action for your rule, as that may provide some context?  That error does not appear to be related with the user picker, single user field you describe.  Thanks!

 

Regarding "why not field name", I suspect that the field name you entered in the JSON does not exactly match what the smart value is...which can be confirmed with the instructions I provided.  In some cases, the custom field ID must still be used, such as field names containing special or non-displayable characters.

 

Regarding your field type, user picker (single user), those are set with automation by either setting the "id" to the user's "accountId" or by setting the field directly, such as with just {{initiator}} (as the default is to use the accountId).  The user's displayName is not used to set user fields.

Phil Bustin May 25, 2022

The automation worked.  Thank you!

1) Apologies: I had copied the field ID from the next field, not the one I wanted; I hadn't realized that the colon and comma meant the ID came first, then the field name.  The automation you see below worked with that correction.

2) If by "smart value", if you mean the field name that appears after the ID, the name sure looks the same as the one I first tried in the rule, but when I coped it from the report (can I call it a report?) and pasted it into the JSON, it worked.  I'll try to figure that one out.

Edit issue action.jpg

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events