i Dint get the Java Script Code . I got bug in that codde Plzz provide me a best easy code for this Question. plzz
i Dint get the Java Script Code . I got bug in that codde Plzz provide me a best easy code for this Question. plzz
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.
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:
How to get and set lookup field value:
Regards,
Clofly
Whats the requirement?
You can use a real time workflow if the trigger is on the child.
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,430
Most Valuable Professional
nmaenpaa
101,156