Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to get data from Parent Entity , Populate on Child Entity in Dynamics 365?

(1) ShareShare
ReportReport
Posted on by 5

i Dint get the Java Script Code . I got bug in that  codde Plzz provide me a best easy code for this Question. plzz

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: How to get data from Parent Entity , Populate on Child Entity in Dynamics 365?

    Hi kartikya Raina,

    Please let me know whether the code would work for you.

    Regards,

    Clofly

    If you had found any answer helped, please kindly mark as verified to close the thread, it would be really appreciated.

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: How to get data from Parent Entity , Populate on Child Entity in Dynamics 365?

    Hi kartikya,

    It seems that you want to get data of record of lookup field. e.g: In contact form, get company's address of the contact and populate a specific single line text field using the value.

    If so, please try following code and check whether it works for you:

    var parentEntity = formContext.getAttribute('lookupfield_logicalname').getValue()[0];
    
    var parentEntityId = parentEntity.id;
    
    var parentEntityName = parentEntity.entityType;
    
    // Select all fields
    var filter = "";
    
    // Select address1_composite field only
    // var filter = "?$select=address1_composite";
    
    Xrm.WebApi.retrieveRecord(parentEntityName, parentEntityId, filter).then(
        function success(result) {
            console.log(result.address1_composite);
            formContext.getAttribute("childfield_logicalname").setValue(result.address1_composite);
        },
        function (error) {
            console.log(error.message);
        }
    );

    API to retrieve single entity record:

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/retrieverecord

    How to get and set lookup field value:

    https://blog.magnetismsolutions.com/blog/adammurchison/2017/09/20/how-to-get-and-set-a-lookup-field-using-javascript-in-dynamics-365

    Regards,

    Clofly

  • Suggested answer
    RE: How to get data from Parent Entity , Populate on Child Entity in Dynamics 365?

    Whats the requirement?

    You can use a real time workflow if the trigger is on the child.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans