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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Getting Parent Entity information on Quick Create Form (using JavaScript)

(0) ShareShare
ReportReport
Posted on by

(Dynamics 365) Background: Account lookup is added on various entities. Creating new Account from lookup opens the quick create form.

I have a requirement where I need to get the parent entity information in JavaScript whenever the Account quick create is getting opened from lookup. I need to call different JavaScript functions based on the parent entity.

Please suggest ways to attain it.

I have the same question (0)
  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    You could use the following JS code to get the entity name where you open the account QC form.

    function getParent(){
        var entity= window.parent.frames[0].Xrm.Page.data.entity.getEntityName();
        alert(entity);
    }

    For example I opened the QC account form in contact, then this code got the contact entity name successfully.

    pastedimage1600136971528v1.png

    pastedimage1600137054936v3.png

    Attention that this code is suitable for chrome, if you are using IE, please replace with "window.parent.frames[1." 

    Best Regards,

    Leo

  • Community Member Profile Picture
    on at

    Hi Leo,

    Thanks for sharing this approach. I noticed that in UCI, I always get the value of window.parent.frames[0].Xrm.Page.data as null when the form is first loaded, if I refreshes the form then it is able to get the parent entity name. Any suggestion to fix that?

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    You could try this code.

    function getParent(){
        var interval = setInterval(function () {
            if (window.parent.frames[0]!=null) {
                clearInterval(interval);
                var entity= window.parent.frames[0].Xrm.Page.data.entity.getEntityName();
                alert(entity);
            }
        }, 2000);
        
    }
    

    Best Regards,

    Leo

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I would highly recommend to avoid unsupported approaches like usage of window, parent, frames and so on when there is a supported way on how you can achieve your goal - butenko.pro/.../

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    Argue with Andrew, the code I provided is not supported in D365, Andrew's feature are provided by D365 Xrm library which will be more suitable.

    Regards,

    Leo

  • Community Member Profile Picture
    on at

    Thank you Leo and Andrew, really appreciate the help!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 146 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 59

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans