Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to access Parent entity Form field using Javascript

(0) ShareShare
ReportReport
Posted on by 247

Hello,

I have a requirement to work on the fields of the parent form on child entity form. The requirement is while working on the child entity form I have to access the values of some field which are available on the parent entity form using JavaScript. 

Shoudl I use the window.parent.Xrm.Page.getAttribute() or it is deprecated now. Is there any other alternative way to access the field of the parent form. Please suggest me some solution.

Thanks

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to access Parent entity Form field using Javascript

    Hi AR,

    Yes, you could use the retrieveRecord() function to get the parent record by parent record id. However, pay attention to this scenario:

    Open a parent main form and modify some fields(Not Save) and then create child record by using quick create form. 

    In this scenario, the fields you modified on the parent main form are not saved. When you use retrieveRecord() function to get the parent record, it would get the original data. So if you want to get the modified value of field, you would better use window.parent.Xrm.Page.getAttribute() to get them. Although window.parent.Xrm.Page.getAttribute() is not supported.

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: How to access Parent entity Form field using Javascript

    Hi,

    You need to use CRM.webapi

    docs.microsoft.com/.../retrieverecord

    I hope you have lookup field on child entity pointing to parent Entity record.

    Thanks,

    Bipin

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans