Jira Email automation based on Asset being Assigned
Asked by Ashley McDonnell:

We have contractors and a separate section in our assets for the contractor laptops. When a laptop is assigned to one of those contractors, a contract is sent to them that contains the device information and price.   

I want to setup an automation that sends the applicable device information to the right people via email when I assign the device to someone.   

I figured out how to trigger the event based on adding the information to a ticket but now I can't get the automation smart values right. Part of the information lives inside the asset, which is getting associated to the ticket.

The field names are included in the screenshot but I can't get it to pull the data. The email is coming back blank.

![2024-04-04_13-54-48.png](https://community.atlassian.com/t5/image/serverpage/image-id/316422i181F00EBEAFB263D/image-size/large?v=v2&px=999 "2024-04-04_13-54-48.png")


Answers:
author: Ashley McDonnell
body: I was able to get these fields figured out (with Mark's help but thought I'd summarize), in case anyone else is looking for something similar.   

{{issue.G7 Contractor Name.label}}  
{{issue.G7 Affected Laptop - Contractor.label}}  
{{issue.G7 Affected Laptop - Contractor.Manufacturer.name}} {{issue.G7 Affected Laptop - Contractor.Model Name.name}}  
{{issue.customfield_10178.Cost}}  

Which returns:   
John Smith  
GAME7LT0120  
Dell Vostro 15 5510  
$930.05  

The top 4 are pulling from fields that are objects in Jira Assets.


author: Mark Segall
body: Hi [@Ashley McDonnell](/t5/user/viewprofilepage/user-id/5469464) and welcome to the community!

If I understand correctly, **G7 Affected Laptop - Contractor** is an asset field. If I'm correct on this, you can use what I have below to get the relevant object attribute information from the field:

NOTE - Without visibility into your object schema, I'm basically making assumptions:

* Contractor Name: Typically, this is captured by a user attribute called something like "Owner" (Change the bold accordingly to what you have for your attribute)
  *

    ```
    {{issue.G7 Affected Laptop - Contractor.Owner.displayName}}?
    ```

* Device Name: This is typically whatever attribute has been set as the "label" whether that's "Name" or some other attribute. You can use label or update to the appropriate attribute name
  *

    ```
    {{issue.G7 Affected Laptop - Contractor.label}}?
    ```

* Model Name:
  *

    ```
    {{issue.G7 Affected Laptop - Contractor.model name}}
    ```

* Cost:
  *

    ```
    {{issue.G7 Affected Laptop - Contractor.cost}}?
    ```

comments: author: Ashley McDonnell
body: I put these in and tested it. It pulled the Device name but none of the other information. I have more screenshots for you in case that helps. Also, the contractor is linked to the ticket as well so I was trying to pull their name from that field instead of owner of the device. Not sure which way is easier.   

This screenshot is from the ticket (issue) where you can see both the contractor that is assigned and the affected laptop field with the device name, which is what the email did successfully populate with.

I was able to pull the contractors name from the ticket successfully into the email with  
{{issue.G7 Contractor Name.label}}  
![2024-04-05_08-00-15.png](https://community.atlassian.com/t5/image/serverpage/image-id/316651i1DD893CDE89DB3A1/image-size/large?v=v2&px=999 "2024-04-05_08-00-15.png")

This is what I see if I select the affected laptop object from the ticket so that you can see the additional fields I'm trying to pull the data from.

![2024-04-05_08-10-33.png](https://community.atlassian.com/t5/image/serverpage/image-id/316654i06E6144EAF3930B7/image-size/large?v=v2&px=999 "2024-04-05_08-10-33.png")


author: Mark Segall
body: Thanks for sharing the screenshots. This helps.

Regarding Contractor name, neither way of pulling it is really better so you should be fine leaving as is.

I see now that **Model Name** is referencing another object so that would change to something like this:

```
{{issue.G7 Affected Laptop - Contractor.Model Name.label}}
```

Not being able to pull in **Cost** is puzzling. Perhaps case sensitivity is in play. In my original answer, I kept it lower case but I see the attribute is upper case. It shouldn't be case sensitive, but just in case, let's try:

```
{{issue.G7 Affected Laptop - Contractor.Cost}}
```


author: Ashley McDonnell
body: No changes. Is it having issue because I want it to pull the object details from a connected object but it's not a direct field inside the ticket? I'm still learning so asking to gain the knowledge.


author: Mark Segall
body: Hmm... I just verified in my environment. I found that using label wasn't working for me so for Model Name you'll need to use whatever the Model Name object is using. For example, if it uses "Name", it would be something like this:

```
{{issue.G7 Affected Laptop - Contractor.Model Name.Name}}
```

I did confirm that attribute names are case sensitive so Cost needs to be capitalized. I don't see any other issues other than perhaps the field name containing a "-". You could try addressing that by using the custom field ID

{{issue.customfield_xxxxx.Cost}}

You can get the custom field id by starting to type out JQL and then using ORDER BY "G7 Affected Laptop - Contractor". In the type ahead helper, it will provide the custom field ID in the form of cf\[12345\]

I hope this helps.


author: Ashley McDonnell
body: I figured out 4 of the five. The last one that I can't figure out is the serial number (called Service Tag now, changed from "Serial #" in the screenshot).  

I've tried.   
{{issue.G7 Affected Laptop - Contractor.Service Tag.name}}  
{{issue.G7 Affected Laptop - Contractor.Service Tag.description}}  
{{issue.G7 Affected Laptop - Contractor.Service Tag.summary}}

It doesn't like any of these. And the field isn't listed in my custom field options in the settings, now is it listed in the JQL search so I can't call it out by field ID.


author: Mark Segall
body: Hi [@Ashley McDonnell](/t5/user/viewprofilepage/user-id/5469464) - You should only need the field name.attribute. You only need to add things like .name if the attribute is referencing another object. So, it should work with just this:

```
{{issue.G7 Affected Laptop - Contractor.Service Tag}}
```


author: Ashley McDonnell
body: [@Mark Segall](/t5/user/viewprofilepage/user-id/4666637) You're amazing. The one thing that I didn't consider trying. This is resolved and working like a charm. Couldn't have done it without you.


Tags: asset-management

automation

cloud

jira-service-management

jira-service-management-cloud