Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Editing custom JPD fields through Automation causes errors

Mart Postma November 10, 2023

Hi all, 

 

I'm trying to set up an automation rule with the following logic:

  • When I link a delivery ticket to an idea in JPD, I want the custom field of that idea (="Coral Component") to be set to one of the options of that custom field. 
  • Which option it should be depends on the Component (Jira Cloud) field of the delivery ticket.
  • See my script below.

automation rules.png

 

But then somehow Jira Automation is not able to find that custom field in JPD, see:

audit error.png

 

Is there any solution to this error? Thanks!

3 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Mart Postma November 17, 2023

@Bill Sheboy 

Got a reply back from support: apparently there is an issue with the configuration of our Automation bot on our Atlassian site. Don't know if the issue is only applicable to our instance or if it is an Atlassian issue in general. Their engineering team is working on a fix.

Rohan Parakh February 8, 2024

@Mart Postma were you able to get this fixed? I am seeing the same issue

Mart Postma February 8, 2024

Hi @Rohan Parakh - yes I was able to get this fixed with the help of Atlassian support. 

The automation would run under my account, but not under the Automation for Jira account. At the time, I reached out to support and it looks like that only they can fix it, so not unfortunately yourself:

That being said, we identified a small issue with the permissions granted to the Automation bot on your site and are already working on a fix. As soon as I get an update from the engineering team I'll let you know!

So if you have the permissions to do so, reach out to Atlassian JPD support and link this Community thread, or ask your (technical) Atlassian site admin to do so for you. They usually don't undertake any action based on issues on the Community pages.

Hope they can help you!

Like # people like this
0 votes
Marina Rambo November 12, 2023

Are you using the customfield_12345 configuration for calling out the field?  Or are you using the name?  I find the custom field is far more likely to work than the name.  

1 . Find the custom field name of your issue by using the Jira API to inspect your JSON.  

https://yourdomain.atlassian.net/rest/api/2/issue/AAA-111?expand=names

Replace "yourdomain" in the above with your jira workspace.  

Replace "AAA-111" with an issue that has Coral Component selected.

2.  Next search the JSON for "Coral Component".

This is easier if you use an online JSON IDE - I used JSON Editor Online.    It will format your JSON so it is easier to read, and give you a search tool to find the info easier.  

If you use it, copy and paste all the JSON that was returned from your REST API query above.  

Once you find the line that says

"customfield_12345": "Coral Component",

you will know you found the right custom field.  

 

Note: this does not address the rest of the automation, just may help find the field you are looking for.  

Mart Postma November 12, 2023

Hi @Marina Rambo 

Thanks for your elaborate reply.

I have found the customfield_id for this field, but how can I now use this field to update/set the new value in the automation rule?

Marina Rambo November 13, 2023

@Mart Postma 

You would then go into > More Options and edit the JSON.  Here is some info on how to do that: 

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

Hope that helps! 

Like Bill Sheboy likes this
Mart Postma November 13, 2023

Hi @Marina Rambo - CC: @Bill Sheboy

I updated the rule with the following JSON (note that XYZ and cf_123 are of course updated in my actual script):

{
"update": {
"customfield_123": [{
"set": "XYZ"
}]
}
}

 But unfortunately I still receive errors upon running:

image.png

Do I need a system-value for "set" as well, rather than the text-value "XYZ"? If so, how to find that one?

Or if not, what could possibly fix this?

Thanks once more!

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

Mart, what is the type of your custom field: single-select, multiple-select, etc.?  The type of field impacts which syntax to use for the JSON edit.

Mart Postma November 14, 2023

Hi @Bill Sheboy - It is a multi-select field.

Edit - also doesn't seem to work...:

{
"update": {
"customfield_123": [
{"set": {"value": "XYZ"}}
]
}
}

 

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

Thanks for that information.

For a multiple-select custom field, there are two syntaxes, depending on whether you want to replace all values or add additional ones.  FYI there are typos in the documentation, so I amended the "add" version to make it more clear.

To replace all please try this one:

{
"fields" : {
"customfield_12345" : [
{ "value" : "option1" }, { "value" : "option2" }
]
}
}

To add additional values:

{
"update" : {
"customfield_12345" : [
{
"add" : { "value" : "option 3" }
}
]
}
}

Please use the one that matches your scenario and let us know what you observe.  Thanks!

Like Marina Rambo likes this
Mart Postma November 15, 2023

@Bill Sheboy @Marina Rambo 

Unfortunately still no success...

image.png

I'm afraid there is no other solution left other than using the web request in automation. Do you believe that would work?

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

Let's checks some things first, as if they do not check out then the field cannot be edited with a Send Web Request to the REST API functions either.

First, have you confirmed that your field is on the views for the issue type in the target project, CORD?

Who is the actor for your rule?  The default is Automation for Jira, which has permissions to change lots of things.  If the actor was changed it is possible they do not have the necessary permissions.

Finally, let's confirm the field can be edited by automation rules using this how-to article.  Essentially you find an example issue in your CORD project that has this field set, call a REST API function using a browser tab, and search for your field on the page (e.g., with CTRL-F).  If the field is not present, rules cannot edit it.  https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Mart Postma November 15, 2023

@Bill Sheboy 

First, have you confirmed that your field is on the views for the issue type in the target project, CORD? -> Yes

Who is the actor for your rule?  The default is Automation for Jira, which has permissions to change lots of things.  If the actor was changed it is possible they do not have the necessary permissions. -> Automation for Jira, did not change the actor since creation. However, I think I found out that the issue lies there. When I change the actor role to my own account, the automation suddenly runs and executes as expected.

Finally, let's confirm the field can be edited by automation rules using this how-to article.  Essentially you find an example issue in your CORD project that has this field set, call a REST API function using a browser tab, and search for your field on the page (e.g., with CTRL-F).  If the field is not present, rules cannot edit it.  -> Yes, field is present.

Like # people like 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.
November 15, 2023

At this point, I recommend working with your Jira site admin to submit a ticket to Atlassian Support, including a link to this thread.  If you are on a paid Jira license, your admin can do that here:

https://support.atlassian.com/contact/#/

They may see something we are missing in the field or rule configuration.  When you hear back from them, please share what you learn to benefit the community.

Like Tomislav Tobijas likes this
0 votes
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 10, 2023

Hi @Mart Postma 

Some of the errors automation rules show do not always indicate the actual, root cause of a problem.  For what your audit log shows, I wonder...

Automation rules which read / edit issues in multiple projects need to be global or multi-project in scope.  A rule which is defined in a single project cannot do so.

What is the scope of your rule: single project or global / multi-project?

Kind regards,
Bill

Mart Postma November 12, 2023

Hi @Bill Sheboy 

The automation scope is set to Global.

TAGS
AUG Leaders

Atlassian Community Events