# Tips: Get "DisplayName" of the Lookup field on Power Automate

Recently, I have leveraged Power Automate to retrieve a list of new deals and then sent this list to the Sales Owner.

In practice, I encountered difficulties when attempting to retrieve the **Account name** and **Primary** **Contact name**, both of which are lookup fields, from the Deals entity.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FeVbABeA8HHaHd5EWcng1%2FCleanShot%202024-03-30%20at%2010.42.03%402x.png?alt=media&#x26;token=74d0adb7-045f-4c40-9ac9-f949c54ba2e7" alt=""><figcaption><p>Deal form: Account &#x26; Primary Contact is lookup field</p></figcaption></figure>

## 1st attempt - Using Dynamics Content

I used the value in  **Dynamic content** (OOB dynamics field content of Power Automate)

<table><thead><tr><th width="357">Dynamics content</th><th width="281">Result</th></tr></thead><tbody><tr><td><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FOqnqtcnCA27BZivipmLn%2Fimage.png?alt=media&#x26;token=a863c20a-1047-493b-a1ba-3c9eea073bfc" alt="" data-size="original"></td><td><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2Fi4vs5F4NxvpPvNu2Ee1H%2FCleanShot%202024-03-30%20at%2022.12.40%402x.png?alt=media&#x26;token=1c3fec23-5cb7-433c-9569-bcbfb51a8310" alt="" data-size="original"></td></tr><tr><td><ul><li>Account (Value): Get record GUID</li><li>Account (Type): Get the entity name</li></ul></td><td><ul><li>Account (Value): <em><strong>fdf6a531-.....</strong></em></li><li>Account (Type): <em><strong>account</strong></em></li></ul></td></tr></tbody></table>

... first try, I failed to get the display name with the OOB dynamic content field of the Power Automate.

## 2nd attempt - Using Expression

Then, I used **Expression** to create the formula and get the Display Name of Account lookup field.

\---

Initially, when displaying all attributes of the **Deal entity** and then applying a filter on the lookup field "**Account**" (*ntd\_account\_id*), I discovered exciting aspects.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FZwFQTHd6ASUxMn4U621Z%2FCleanShot%202024-03-30%20at%2022.31.25%402x.png?alt=media&#x26;token=1aec8dd9-bd9b-43e6-be52-4c5e7ef9f79c" alt=""><figcaption><p>All attributes of the field "Account" (ntd_account_id)</p></figcaption></figure>

I observed the first value is the "Display Name" of the Account field, I promptly accessed Power Automate and employed the mentioned attribute in my expression.

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>//The expression:
</strong><strong>item()?['_ntd_account_id_value@OData.Community.Display.V1.FormattedValue']
</strong></code></pre>

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FoR4rclJwJmRgrQxAonUf%2FCleanShot%202024-03-30%20at%2022.38.59%402x.png?alt=media&#x26;token=774698b0-a643-42ad-8e9d-2888b5465346" alt="" width="375"><figcaption><p>Power Automate used Expression</p></figcaption></figure>

... And checking now:

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2Fg6MMbHEeBH7H3QwZDfrs%2FCleanShot%202024-03-30%20at%2022.44.01%402x.png?alt=media&#x26;token=800ad36a-2fa7-4f3a-9d14-771ade67e027" alt="" width="375"><figcaption><p>The final result - Get the "Display Name" of Account lookup field</p></figcaption></figure>

Thank you for reading & Hoping well... :tada:\
\&#xNAN;**\[NTD]yns.asia**\
...[invite me a cup.](https://ko-fi.com/ntdyns/?ref=qr\&amp;v=2) :coffee: <mark style="color:blue;">Thank you.</mark> :heart:
