Recent Posts

ads

How to we assign the CustomerLookup value to another Customer Lookup in Microsoft CRM:

Today I will show to set the qualities into one Customer Lookup to another Customer Lookup utilizing webapi javascript in Microsoft CRM. 
Initially we have to think about what is CustomerLookup.Before we have two changed fields to pick in Lookup however after deprication of 2015 they will give CustomerLookup here the primary benfit is decrease of time. Here no compelling reason to make two Lookups for Account and Contact in CustomerLookup as a matter of course they given two fields soo we will keep away from of wastage of time and application weight of information.
MicrosoftCRM service


Assign CustomerLookup to CustomerLookup Using javascript webapi:


function RetrieveLookupRecord() {

    debugger;     try {         var offerGuid = null, nextLine = "\n";         //offerGuid = Xrm.Page.data.entity.getId();         offerGuid = Xrm.Page.getAttribute("lvt_offerlookup").getValue();         if (offerGuid != null && offerGuid != "") {             Xrm.WebApi.retrieveRecord("lvt_offer", offerGuid[0].id, "$select=lvt_address,lvt_email,lvt_phone,_lvt_customerlookup_value")             .then(function (data) {                 retrieveContactSuccess(data);             },              function (error) {                  Xrm.Utility.alertDialog(error.message);              });         }     } catch (e) {         Xrm.Utility.alertDialog(e.message);     }     ///retrieve success     function retrieveContactSuccess(data) {         try {             //get the values             //string             var Address = data["lvt_address"];             var Email = data["lvt_email"];             var Phone = data["lvt_phone"];             var retrivedvalue = data["_lvt_customerlookup_value"];             var retrivedvalueformatted = data["_lvt_customerlookup_value@OData.Community.Display.V1.FormattedValue"];             var retrivedvalueentityType = data["_lvt_customerlookup_value@Microsoft.Dynamics.CRM.lookuplogicalname"];             if (retrivedvalue != null) {                 var value = new Array();                 value[0] = new Object();                 value[0].id = retrivedvalue;                 value[0].name = retrivedvalueformatted;                 value[0].entityType = retrivedvalueentityType;             }             Xrm.Page.getAttribute('lvt_address').setValue(Address);             Xrm.Page.getAttribute('lvt_email').setValue(Email);             Xrm.Page.getAttribute('lvt_phone').setValue(Phone);             Xrm.Page.getAttribute("lvt_customerlookup").setValue(value);             }                             catch (e) {             Xrm.Utility.alertDialog(e.message);         }     } }



Thankyou! 


Post a Comment

0 Comments