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

Loop over asset objects and update them using Jira Automation

Sidharth verma July 17, 2024

Hi,

I have asset objects created as below :

Name            Assigned

A                         0

B                         0

C                         0

 

I want to loop over all the above asset objects and update the assigned value to 1 based on the issues assigned to the team members i.e. If team member A is assigned an issue it should update the assigned value to 1.

typically, updating an asset object can be done using AQL branching and thats what i tried in the below automation:

Screenshot 2024-07-17 140623.png

In the above automation i am looping through my asset object "Cummins Deployment Team" and then querying the team members name using lookup issues and accessing the team members name as {{Object.User}}. However, {{Object.User}} returns all the users rather than the first one and hence the query also doesn't return anything. How can i ensure that I can loop through the objects one by one and query them with lookup issues?

Please let me know if there is any workaround for the same.

 

2 answers

2 accepted

0 votes
Answer accepted
Sidharth verma August 29, 2024

It is working now thanks. 

0 votes
Answer accepted
Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 19, 2024

Hi @Sidharth verma ,

At first sight, your automation rule seems to be setup correctly.

The audit logging in automation rules is a bit confusing if your AQL results in multiple found objects. Your log action will display all found objects.

But your "Lookup Issues" will be executed for each individual object. And thus you can also process each result individually.

I'm not sure what you do exactly in the last "edit object attributes" exactly. That's not visible in your screenshot.

Best regards,

Kris

 

Sidharth verma July 19, 2024

Hi @Kris Dewachter

Attached is the log output for the above rule:

Screenshot 2024-07-19 233816.png

(Please ignore the delay statements I have just put it to try something)

let me explain in brief on what i am doing:

1.) Return multiple Asset objects using the advance branching AQL statement.

2.) Loop through each object one by one. Ideally in the first iteration object should return only first object and will access the attribute user of that using {{Object.User}} statement. However, as per the above log it is returning all the objects.

3.) Lookup issues using a JQL query with the {{Object.User}} as argument. however, as per above log it doesn't return any issues as all the users are returned.

4.) Edit the asset object attribute "Assigned" and add the value as Number of issues found from JQL query i.e. {{lookupissues.size|0}} value.

I think the main problem is all the users are returned when i use {{Object.User}} inside the loop. Not sure how to access the object one by one inside the loop?

 

 

 

 

Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 21, 2024

Hi @Sidharth verma ,

I agree with you that it would be ideal if the automation log would display each object individually. But unfortunately, it will not. All objects will be displayed together in the log as you see now. There is no way to improve that.

I can see in the audit log that a search was performed, and the objects where successfully updated. That's the good news.

However, I can see the objects have been updated with value 0, and the query states the lookup action "found no issues". So i'm presuming there is some kind of error in the JQL. Can you validate if the JQL is correct by constructing it in a variable in the automation rule, and display the constructed JQL in the audit log ? Then, you can copy/paste this in the Jira issue search and check if it produces any results.

Best regards,

Kris

 

 

 

Sidharth verma July 22, 2024

Hi @Kris Dewachter

 

as suggested i constructed the query into a variable and added in the log. looks like the query was correct. However, i was using the property {{lookupissues.Size}}, which was incorrect as it was case-sensitive.

when i changed it to {{lookupIssues.size}} it took the correct values and updated them in Assets. Thanks for your suggestion !!Screenshot 2024-07-22 192339.png

However, one strange thing is there in the above log that it still showing that lookupissues did not find any issues. but when we access the number of issues using {{lookupIssues.size}} it is getting the correct number. 

 

Like Kris Dewachter likes this
Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 23, 2024

Hi @Sidharth verma ,

I'm not sure but i think the "lookup Issues" action only logs the result of the first ticket (PT-131).

Best regards,

Kris

Suggest an answer

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

Atlassian Community Events