Forums

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

how to copy asset field value into a custom field via automatization

johan.drabarek October 27, 2024

Hi,
I need to edit the issue custom field with the attribute value of the asset field.
Field to be updated is a custom field:

"Obszar IT i Bezpieczeństwa" customfield_10165

Value to be taken from asset type: "Usługa" asset Key: US-1091 from attribute: "Obszar usługi"

Could you help me to create such automatization, please?

 

I tried several options without possitive result e.g. 

1.  {{US-1091.obszar usługi.id}}

2. { "fields":{ "customfield_10165":[ { "id": "{{issue.US-1091.obszar usługi.id}}" } ] } }

 

asset Usluga.png

 

custom fields settings.png

3 answers

0 votes
johan.drabarek October 30, 2024

Hello, can anybody help me t osolve this issue, please?

There must be "a simple" way how to insert into Custom field the value from the particular asset attribute.

 

0 votes
johan.drabarek October 27, 2024

Hello Walter :)
thank you for you prompt reply.

I'm sorry but the case you refer to is more complicated than I need thus still not sure how to proceed. 

Could you explain, please?

Kind regards,

Johan

0 votes
Walter Buggenhout
Community Champion
October 27, 2024

Hi @johan.drabarek and welcome to the Community!

While you can copy an attribute from a assets object to another custom field, you can also display more attributes from the asset on your issue directly on the assets custom field itself.

Having said that, you should add a Lookup Objects action to your rule to find the object referred to on your issue. You should then be able to refer to the attributes of the returned object to add the desired value to your custom field.

Have a look at this related thread which has an elaborate discussion and examples on how to set this up.

Hope this helps!

Walter Buggenhout
Community Champion
October 27, 2024

I am not sure the referred case is more complex than you need, @johan.drabarek, but in short:

  1. You need to trigger your automation rule somehow. That can be issue created, issue transitioned,  ... anything that makes sense as a starting point for the update.
  2. Next, add a Lookup Objects action to get the object details from the object linked to your issue. That should use an AQL filter that does something like this: objectType = Usluga AND Key = {{issue.<your asset field>}}. This will return a variable {{lookupObjects}} that you can use in the next step to set your other custom field.
  3. Add an action Edit issue and update the custom field you want to set. Its value should be something like this {{lookupObjects.<attribute name>}}
johan.drabarek October 27, 2024

please see my settings:

Zagubienie/kradzież sprzętu - is my asset field which from I would like to take attibute: Obszar usługi
setup1.png

and put this valu into cf: Obszar IT i Bezpieczeństwa

setup2.png

but I get an error message:
setup3.png

Walter Buggenhout
Community Champion
October 27, 2024

Just 2 things, @johan.drabarek:

  • Try adding quotes to the AQL filter in your Lookup Objects action, like this: objectType = "Usluga" AND Key = "{{issue.Zagubienie/kradzież sprzętu}}"
  • And what type of field is the field you are trying to update? Is it an assets field? A plain text custom field? Something else?

If adding quotes still doesn't work, it might help to add a log action action to your rule, writing the value of {{issue.Zagubienie/kradzież sprzętu}} to the audit log, so it is clear what it returns.

johan.drabarek October 27, 2024

Thank you Walter,

ad.1. This fixed the previous error in the audit log, but still there is an error saying: No objects found

ad.2. the field I'm trying to update is Custom Field: "Obszar IT i Bezpieczeństwa" customfield_10165

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