Include a custom field of a card linked to another one
Asked by Laura Garcia Mozo:

Good morning,

Is it possible to create an automation from which you can include a custom field of a card linked to another one?  
Thank you very much


Answers:
author: Gideon Nolte _Jodocus_
body: Hi [@Laura Garcia Mozo](/t5/user/viewprofilepage/user-id/5100408)

I would suggest using the "Lookup issue" action, with which you can specify JQL to retrieve issues. With said action you are able to search for issues linked to the issue that triggered the rule by using SmartValues like this:

```
key in linkedIssues("{{issue.key}}", "relates to")
```

Note that you can specify the link type so that it matches your case.  

After that action you can access custom field values from the linked issues by using:

```
 {{lookupIssues.customfield_XXXXX}}
```

If you only want one value (of the first issue found by the jql) use:

```
{{lookupIssues.first.customfield_XXXXX}}
```

<br />

Hope this helps. Feel free to ask if anything is unclear or you run into other problems.  

Greetings  
Gideon  

comments: author: Gideon Nolte _Jodocus_
body: Sorry - I thought you were looking for an answer regarding automation for Jira. I must have missed the Trello label in the first place. Feel free to ignore my answer.


author: Laura Garcia Mozo
body: First of all, thank you very much for your reply,

Can you give me a concrete example? I can't find in the rule commands the action "Lookup issue"?


author: Gideon Nolte _Jodocus_
body: Okay, so I looked into Trello Automations.   

It seems there is no good way to use the custom field of a linked card in the triggering card. If you want to send mails or something along these lines, you can "change the context" of the rule. What I mean by that, is that by using the cascade actions in Trello Automation, you can either lookup (get data of other card but "stay" on trigger card) or find (switch all following actions to that card) a card. For example: If you find a card that is attached and then use {{%CustomfieldName}} inside a comment action, the comment will be created on the card that you found and will have the customfield value present. If you lookup a card, and use the comment action afterwards, the comment will apear on the triggering card. Unfortunately, I was not able to find a way with which you can lookup a card and use the custom field values of said card. You could use the find action in cases where you want to send a mail or something that is not depending on a specific card.   

An automation could then look something like this:

```
when the dark black "trigger Butler" label is added to a card, for each card linked in the attachments, send an email notification to "gideon.nolte@jodocus.io" with subject "Notification" and message "{{%Status}}"
```

<br />

Alternatively, you could use a combination of two rules. One to add a comment to the linked card with the value of the customfield and a given prefix, and then have another rule listen for said comment to add it to the original issue - given that the link is bidirectional. The rules would then look like this:

```
when the dark black "trigger Butler" label is added to a card, for each card linked in the attachments, post comment "For Linked Card: {{%Status}}"
```

```
?when a comment starting with "For Linked Card:" is posted to a card, for each card linked in the attachments, post comment "{textaftermatch}"
```

Note, that this adds a comment to both cards - which might be undesirable.  

If you feel super techy, you might want to look into solving the whole problem by utilizing the Trello API inside the automation rules to add a comment to the trigger issue from within the context of the found issue.   

Hope this helps and/or points you into some useful directions.  

Greetings  
Gideon


author: Laura Garcia Mozo
body: Many Thanks