Notifications
Announcements
No record found.
i Dint get the Java Script Code . I got bug in that codde Plzz provide me a best easy code for this Question. plzz
Whats the requirement?
You can use a real time workflow if the trigger is on the child.
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
Hi kartikya Raina,
Please let me know whether the code would work for you.
If you had found any answer helped, please kindly mark as verified to close the thread, it would be really appreciated.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Siv Sagar 93 Super User 2025 Season 2
#ManoVerse 76
Martin Dráb 64 Most Valuable Professional