How to update asset attribute from all assets within a list

Marius Fassbender October 17, 2024

Hi,

from an application I receive a list, either as csv file or just a list to copy to your clipboard. For all assets within that list, I want to edit an user attribute from those assets to the reporter. 

To process that csv list with automation, you need to send a Web Request and handle the attribute update via API.

I want to do it only within automation, so I have a request type with only a custom field which is a multi line text field. So from my application, I copy the list which looks for example like:

"ITAM-1
ITAM-2
ITAM-3"

My automation rule looks like this

Screenshot 2024-10-17 161727.png

Screenshot 2024-10-17 161747.png

Screenshot 2024-10-17 161800.png

Screenshot 2024-10-17 162804.png

 

So from my understanding, this advanced branching should handle every line within the list seperately and for each assetKey in the list, lookup that object and edit my attribute to the issues reporter.

The audit log looks like this

Screenshot 2024-10-17 163229.png

Does anyone has a tip for me how to handle this correctly?

Thanks in advance

 

 

1 answer

1 accepted

2 votes
Answer accepted
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 27, 2024

Hi @Marius Fassbender 

2 things to note (as per the documentation): https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Edit-object

1. To use the Edit Object action, you need to use the AQL branching.

2. It won't work with the Lookup objects action

You can try the below setup to see if it works:

  • Keep this part of the automation intact : Automation 1
    image.png
  • Create a new automation that is triggered by a Incoming Webhook: Automation 2
  • Go back to the Automation 1, and add a action in the "for each" called "Send-web-request", pass the "AssetKey" and "Issue Key" as parameters to this webrequest.
  • Coming back to the Automation 2, reference the issue key and AssetKey from the webhookdata, and pass it in the AQL loop. Once this is done, add the same edit object action and see if it makes the feature available.

Hope this helps.

 

Marius Fassbender October 28, 2024

Hi @Jehan Bhathena

thanks for your reply!

Can you tell me how to refer correctly to the WebHook Elements?

 

The first rule is handing over the correct values in the headers:

Screenshot 2024-10-28 112356.png

 

In the second Automation Rule, i tried to refer to them with

{{webResponse.headers.assetKey}},

{{webhookData.headers.assetKey}},

{{webhookData.header.assetKey}},

{{webhookData.assetKey}}

 

I added those variables to the log within the second Automation Rule to see if they have a value but unfortunately they stay empty:Screenshot 2024-10-28 112745.png

Screenshot 2024-10-28 112722.png

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2024

Hi @Marius Fassbender 

In the "Log Action" try printing {{webhookData}} directly, this will show you the complete JSON data that is being sent to the other automation. Please can share that here once printed, will be able to help with the syntax then. :-)

 

Like Marius Fassbender likes this
Marius Fassbender October 29, 2024

Here is the {{webhookData}} Output:Screenshot 2024-10-29 091755.png

As webhookData.headers didn't work, I now tried {{webhookData.fields.customfield_10219}} / {{webhookData.customfield_10219}} as assetKeys and {{webhookData.displayName}} / {{webhookData.fields.displayName}} / {{webhookData.fields.reporter}} as Reporter but my variables are still empty.

Like Jehan Bhathena likes this
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 29, 2024

Hi @Marius Fassbender ,

The output in the Log Action has been trimmed, due to it's length.

What I would suggest to change in your original automation, is to trigger a Web Request for each asset available(1), and change the request body to "Web request body" to Custom(2). Adding attachments below:

1.  image.png

2.  {16053ABB-07BE-4198-A0B2-E12AD1EDA207}.png

In the Custom body send only the CURRENT assetID, this Asset ID can then be used in the next automation, as reference to a AQL branch which should make your "Edit Object" action work correctly.

 

Hope this works :-)

Like Marius Fassbender likes this
Marius Fassbender October 29, 2024

Sending my values as custom data did the trick. I can refer those now as {{webhookData.*Custom data*}} in my 2nd automation so it finally works now. 

I still send all the Asset-ID's from my custom field at once, but with the Branch AQL statement "IN" for going through all those ID's it works.

 

Screenshot 2024-10-29 120723.png

Thank you very much @Jehan Bhathena for helping me out with that!! :-)

 

Like Jehan Bhathena likes this
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 29, 2024

Glad to know it works now.

Cheers 🥂

Like Marius Fassbender likes this

Suggest an answer

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

Atlassian Community Events