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

Set a Custom Field (Assets object) using Jira automation

Scott Bickerton March 28, 2024

We have a custom field (in this example - "Related Control") which is configured to link to a Jira Assets object, but would like to set the value in certain automations.

For example, suppose we have a Request type which always relates to a Cryptography control, we would like to set this automatically when a request is raised.

The field works fine when setting manually - it is configured to link to a particular schema, and when manually editing a ticket it is possible to select multiple values, as expected.

Screenshot 2024-03-28 at 12.01.04.png

When using automation, I can retrieve the attributes of Assets objects using AQL, and use these in further automation, but I am unable to set the custom field to the Assets object.

When using the "Edit Issue Fields" action, selecting the "Related Control" field in my example prompts for AQL:

Screenshot 2024-03-28 at 12.05.31.png

When clicking on "Validate Syntax", the following pop-up appears, regardless of the AQL entered:

Screenshot 2024-03-28 at 11.43.07.png

I have tested using multiple AQL queries, but get the same error. I am, however able to retrieve the object values using the same AQL in a "Lookup Objects" action.

I have checked the custom field configuration, and I am searching on attributes which are searchable

Screenshot 2024-03-28 at 12.11.49.png

Has anyone else experienced this issue, or have any suggestions of another method to automate the population of the custom field with the appropriate Assets object.

3 answers

1 accepted

2 votes
Answer accepted
*ServiceRocket* KL Foong March 31, 2024

Hi @Scott Bickerton 

The validate function has a bug Assets Automation: Validate Syntax for Object Attributes in Automation is failing 

If the AQL in a "Lookup Objects" action works fine, it can be used in Edit Issue action without validation.

Scott Bickerton June 4, 2024

Sorry for the delay in marking this query as resolved. There were a couple of contributory issues.

Firstly, as @*ServiceRocket* KL Foong states, the "Validate Syntax" option doesn't work in this scenarion, however the AQL works fine and returns objects which can then be used for further automation.

Secondly, when I initially had issues, I was attempting to search on an attribute which wasn't searchable in the custom field configuration. Making the attribute searchable fixes that issue.

1 vote
Danielle Alota May 20, 2024

Heya @Scott Bickerton and anyone that's stumbling across this.

TLDR; I think you're looking for the keyword 'Key'. The Lookup Object action returns the object key (eg. ABC-1111}. So when creating/editing an issue with assets as a custom field, you're looking to do:

key = {{lookupObjects}}

 


I ran into this issue just today. My use case was that I needed to create new issues every week for each asset with objectType = "Office".

eg. Name = Office Sydney

Abbreviation = SYD

To test, I used Lookup Object action and AQL to find the object: objectType = Office and "Name" = "Office Sydney". This gave me PRP-123, and I was able to do {{lookupObject.Abbreviation}} to get SYD.

In my Create Issue action, I selected the assets custom field "Office". For the AQL, I used key = {{lookupObjects}} and it linked the issue to the object.

 

I hope this helps! 

0 votes
Bao Truong May 30, 2024

My solution involves using the 'key in(object)' function.

Screenshot 2024-05-30 at 17.59.15.pngScreenshot 2024-05-30 at 18.00.15.png

 

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