web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

{Portals} How to access related entity field in liquid template

(0) ShareShare
ReportReport
Posted on by 55,410 Moderator

I am using fetch xml/ liquid to retrieve the entity details. This works fine and I can display the retrieved fields from the main entity. However I also have a linked entity and want to display the field from that as well. I tried different combination but nothing worked.

{{ result.<alias>.<fieldname> | escape }} - not working
{{ result.<fieldname> | escape }} - not working
{{ result.<related entity schema name>.<fieldname> | escape }} - not working
{{ <alias>.<fieldname> | escape }} - not working

Any thoughts?

*This post is locked for comments

I have the same question (0)
  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    Hi Nicholas,

    I haven't assigned the entity permission to authenticated web roles, now it's working. Thanks a lot for the help

  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at
    RE: {Portals} How to access related entity field in liquid template

    The Liquid code enforces Entity Permissions.  Add a web role to that user that has Entity Permissions with read access to Accounts and then it should work.

    Nick

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    Hi Nicholas,

    user.contact_customer_accounts.address1_line1 this works only when my user is logged in as a administrator on the portal but it dosen't work for the users assigned authenticated web roles. Any solution to this ?

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    Hi Nicholas when I am logged in with a different user I am not able to see the account fields.

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    Thanks a lot Nicholas. Now I am able to access the account fields.

  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at
    RE: {Portals} How to access related entity field in liquid template

    You are correct - parentcustomerid is the entity reference object, which only gives you ID and name.  To get access to the entire entity, use the relationship name instead of the name of the lookup field, like so:

    user.contact_customer_accounts.address1_line1

    Nick

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    parentcustomerid is an entity reference object. I want to access the account fields related to contacts of that account to show up in the copy area on the webpage in MSCRM portal.

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    I just need to access the related account fields of the contacts through liquid code. I am able to show up the name and id using the following liquid tag:

    {{user.parentcustomerid.id}}

    {{user.parentcustomerid.name}}

    but not able to access the other fields

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: {Portals} How to access related entity field in liquid template

    Did you try the above suggestions, that (getting aliased value) worked for me.

  • ammi64 Profile Picture
    87 on at
    RE: {Portals} How to access related entity field in liquid template

    Hi Ravi,

    can you please help me out on how to access  related entity field in liquid template, need an urgent response from your end.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#3
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans