Forums

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

How to use Asset custom field in automation

Steve Mélon November 29, 2023

Hello there, 

Capture d’écran 2023-11-29 à 10.22.32.png We're using Asset w/ Jira Service Management and I would like to know how to do the following : 

When an issue is created, check the value of an asset type custom field and then operate some action. 

The user is invited to pick a center to declare an incident and depending on the zone where the center is located , the request will be edited in certain ways. 

Center is an object that has a reference on another object call Zone.  

As you can see in the image: I would like to do something such as : {{customfield}}.Zone.name = "Wallonie Est" 

Is this feasible? 

Many thanks :) 

 

4 answers

2 accepted

3 votes
Answer accepted
Sam Huawey
Contributor
March 7, 2024

The only working code I managed to create for Assets custom field is the following:

{{issue.MyAssetField.asJsonStringArray.substringBeforeLast(" (").substring(2)}}



asJsonStringArray converts internal Java object into string like this:

["value (KEY-22)"]

Other 2 functions convert JSON to actual value.

Perhaps Atlassian should think about exposing Asset object fields as properties in Smart Values, but as for now they did not do it.

Matt Donnelly May 16, 2024

This was exactly what I needed, thank you!

Julius Zatroch
Contributor
December 23, 2024

In Server/DataCenter Automation works: 

{{issue.MyAssetField.summary}}  =  value

{{issue.MyAssetField.key}}  =  KEY-22

{{issue.MyAssetField}}  =  value (KEY-22)"

0 votes
Answer accepted
Xavier Tang
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.
June 20, 2024

Hi,

I looked for a solution to update a custom field using an asset objet contained in an asset type field of the same issue within a Data Center Instance. I found this discussion as well as others, but I failled to produce a relevent solution. Finally, I met this page: https://confluence.atlassian.com/servicemanagementserver0505/post-functions-1206783457.html. It's easy to use post functions of Jira workflow to solve my concern.

Cheers.

Xavier

 

0 votes
Steve Mélon November 29, 2023

Hello  @Paul Wiggers

Thanks for your input. Unfortunately, I cannot find the LookupObject action in the list of possibles actions. 

But in my case, maybe i can already access the field? It's a custom field of type asset that is already select by the users and what I would like to do is : 

When issue created 

IF {{customFieldId_13901.Zone.Label}} is equal to "A value" 

Then

Edit issue 

0 votes
Paul Wiggers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 29, 2023

Hello @Steve Mélon 

Thank you for your question and yes, this is certainly possible!

In your automation, you first need to Lookup the Asset object that you would like to use.

Use the Lookup Object action, specify your schema and set the query. For instance, here I am getting the customer object based on the reporter from our ITSM schema:

Screenshot 2023-11-29 at 11-22-58 OutSmart Servicedesk - Details - Service project - Jira.png

When you have fetched your object. You can use the details further down in the automation by using the smart value {{llookupObjects}}. For instance, here I am filling the label field with a customers country of residence:

Screenshot 2023-11-29 at 11-25-23 OutSmart Servicedesk - Details - Service project - Jira.png

Is this something you can work with or do you need some additional assistance?

Kind regards,

Paul

Steve Mélon November 29, 2023

Hello  @Paul Wiggers

Thanks for your input. Unfortunately, I cannot find the LookupObject action in the list of possibles actions. 

But in my case, maybe i can already access the field? It's a custom field of type asset that is already select by the users and what I would like to do is : 

When issue created 

IF {{customFieldId_13901.Zone.Label}} is equal to "A value" 

Then

Edit issue 

Like Jael Carvalho likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events