Forums

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

Email Custom field [Assets] trough Automation

Albert Manuel
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.
August 11, 2023

Hi,

I have a custom field (Assets Object), where i have different options objects. Now i want to make a simple automation rule where i send the value of this custom field from a ticket into an email.

So I have configured automation that says, when a ticket is created on this issue type - send an email:

 

Screenshot 2023-08-11 182654.png

This is a simple rule - and works just fine BUT - being an Assets field - it gets me the value of the field + the ID from the Assets - the result i get on email being:

The Impact is: Very High (HOF-8057)

How do i get rid of the ID ? i tried {{issue.customfield_11406.name}} - doesn't get me anything.

 

Thanks

4 answers

1 accepted

0 votes
Answer accepted
Albert Manuel
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.
August 14, 2023

Found the solution - the documentation is a bit wrong or hard to understand.

The solution for those who want to get just the name of the Object and Not the ID, in the server/datacenter editions is to use the formula:  {{"Name of your field".summary}}  works also with

{{issue.customfield_12345.summary}}
0 votes
Aaron P.
Contributor
September 6, 2023

for me is more easy use the name of the field as appears in the issue, for example:
{{computer.ID}} or {{computer.user}}
but if the field is configured for supports more than one value, you you should use the sintax:
{{#computer}}{{value}}{{/}}
This sintax create a loop and write all values of the field

0 votes
Rudy Holtkamp
Community Champion
August 13, 2023

Hi @Albert Manuel 

You are on the right track.

Just use:

  • {{issue.fields.customfield_11406.label}}
  • {{issue.fields.customfield_11406.Name}}
  • {{issue.fields.customfield_11406.AttributName}}

But do note that it is case sensitive. If you use an uppercase in the naming of your attributes in the objectschema, then you need to use it also here.

And 'label' is a special attribute, in the object schema it is mostly used to name your object. But you can have the name attribute called e.g.: Name Nome, Navn, Nom 

And with the label you can refer them all as 'label'.

Albert Manuel
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.
August 14, 2023

Hi Rudy, thanks for jumping in on this.

I have tried all the options with:

  • {{issue.fields.customfield_11406.label}}
  • {{issue.fields.customfield_11406.Name}}
  • {{issue.fields.customfield_11406.My Attribute}}

I have even created my own attribute etc...nothing works - the email it's coming blank where the value of this field should be.... as i said, if i use just {{issue.customfield_11406.name}} works but if i add anything after - it's getting nothing - i need to research more..

Rudy Holtkamp
Community Champion
August 14, 2023

Could post the JSON of an issue:

https://{yoursite}.atlassian.net/rest/api/latest/issue/{issue}?expand=names

And

A screenshot of the CMDB object you are referring to in that issue?

Albert Manuel
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.
August 14, 2023

Sure, here is all the information (I'm in datacenter edition):

Here is the JSON - as you can see, there is nothing else:

expand.png

So i think this is the problem, that even in the Json, there is nothing else...

Rudy Holtkamp
Community Champion
August 14, 2023

Earlier you showed customfield_11406 and now customfield_11415 is this a mistake?

 

And you are on server (I assumed Cloud), so there could be differences.

You might be able to do a REST API call to get the correct attribute. To do so, you need to add a send web request to

{yoursite}/rest/assets/{version}/object/{issue.customfield_1106.id}/attributes

Use the GET method and add the correct headers (Content-Type: application/json & Authorization: Basic XXXX) Where XXXX is the API-key.

Use the checkbox to wait for a response)

With {{webResponse.body}} you can find the attribute value you are looking for.

0 votes
Albert Manuel
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.
August 11, 2023

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events