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 :
Customer experience | Sales, Customer Insights,...
Suggested answer

How to Map Lookup field to other entity look up field

(0) ShareShare
ReportReport
Posted on by 20

Hi All,

I am trying to map the lookup field of account entity to contact entity lookup field by using the workflow and tried with CRUD operations but i did not get the out put. Please help me.

Requirement is that on create of account record all the values mentioned in account entity with same values a duplicate record should be created in contact entity.

I am facing difficulty in getting and setting the lookup field. I tried this with CRUD operation but no luck. 

Thanks and Regards,

New to Ms Crm Dynamics

Sultan

I have the same question (0)
  • Haritha222 Profile Picture
    120 on at
    RE: How to Map Lookup field to other entity look up field

    Hi Shaik,

    Please try below steps

    1.Goto advanced settings

    2.select patch/solution

    3.select account entity

    4.select relationship(Contact & Account)

    5.Under information ,mappings is there

    6.Create a new mapping (select fields )

    Note: Map fields with same datatype

  • Suggested answer
    Shaik Sultan Profile Picture
    20 on at
    RE: How to Map Lookup field to other entity look up field

    Thanks for your response.

    I tried with the mentioned steps but no output.

    Record must be created in contact entity if we create the record in account entity. Record is getting created but the value mentioned in lookup field is not populating in contact entity record.

    Kindly provide me some reference this will help me.

  • Haritha222 Profile Picture
    120 on at
    RE: How to Map Lookup field to other entity look up field

    community.dynamics.com/.../mapping-lookup-fields

    Please refer above link.it may be helpful

  • Shaik Sultan Profile Picture
    20 on at
    RE: How to Map Lookup field to other entity look up field

    Hi Haritha,

    If you have look at the code you will know where i have to make the corrections.

    function CreateRecordInContact (executionContext) {

       var formContext = executionContext.getFormContext();

       var LName = formContext.getAttribute("name").getValue();

       var AccountLookup = formContext.getAttribute("new_contactlookup").getValue();

       var entity = {};

       entity.lastname = LName;

       entity["cr04d_accountlookup@odata.bind"] = AccountLookup;

      // entity.creditonhold = null;

       var req = new XMLHttpRequest();

       req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/contacts", true);

       req.setRequestHeader("OData-MaxVersion", "4.0");

       req.setRequestHeader("OData-Version", "4.0");

       req.setRequestHeader("Accept", "application/json");

       req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

       req.onreadystatechange = function () {

           if (this.readyState === 4) {

               req.onreadystatechange = null;

               if (this.status === 204) {

                   var uri = this.getResponseHeader("OData-EntityId");

                   var regExp = /\(([^)]+)\)/;

                   var matches = regExp.exec(uri);

                   var newEntityId = matches[1];

               } else {

                   Xrm.Utility.alertDialog(this.statusText);

               }

           }

       };

       req.send(JSON.stringify(entity));

    }

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: How to Map Lookup field to other entity look up field

    Hi Shaik Sultan,

    Did you try the workflow?

    pastedimage1671478671298v1.png

    pastedimage1671478708022v2.png

  • Suggested answer
    Shaik Sultan Profile Picture
    20 on at
    RE: How to Map Lookup field to other entity look up field

    Hi,

    I tried the workflow record is getting created but the lookup field and optionset fields are not mapping in contact entity record. 

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 > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 165

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 148 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans