how to get related field of an entity from lookup id in crm without api
how to get related field of an entity from lookup id in crm without api
Hi Partner,
Can you click Yes under "Did this answer your question?" to close this thread if your problem has been solved.
Thanks.
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
If its a lookup, say Account, and you want data from it to appear on its child - Contact. You can do a real time workflow as well (or background). You can reach one level up from OOB workflows.
Thanks, actually no I don't have any particular reason. I just wanted to know whether it is possible or not.
Thanks mam
Hi Dushyant agre,
You will need to use an API such as Xrm.WebApi.retrieveRecord in order to achieve this. Is there a particular reason you do not want to use an API?
The following example demonstrates how to retrieve the contact for an account record with record ID = a8a19cdd-88df-e311-b8e5-6c3be5a8b200. For the related contact record, we are only retrieving the contactid and fullname properties. You can adapt this code to meet your requirement.
Xrm.WebApi.retrieveRecord("account", "a8a19cdd-88df-e311-b8e5-6c3be5a8b200", "?$select=name&$expand=primarycontactid($select=contactid,fullname)").then( function success(result) { console.log("Retrieved values: Name: " result.name ", Primary Contact ID: " result.primarycontactid.contactid ", Primary Contact Name: " result.primarycontactid.fullname); // perform operations on record retrieval }, function (error) { console.log(error.message); // handle error conditions } );
The above example displays the following in your console; you might see other values depending on your data:
Retrieved values: Name: Adventure Works, Primary Contact ID: 49a0e5b9-88df-e311-b8e5-6c3be5a8b200, Primary Contact Name: Adrian Dumitrascu
Hi Dushyant,
Maybe you can use power automate to retrieve parent entity based on lookup field in child entity form.
For example, I have a custom entity, it is N:1 relationship with account entity.
1.Go Power Automate(https://us.flow.microsoft.com/en-us/ )
Set ‘When a record is selected’ as trigger, you can select other trigger based your needs.
2.Add ‘Get record’ action to get parent entity record(Account).
3.Then you can get any fields of the parent records, and use them to do any operations you need.
For example, I get account name field value of account with using ‘compose’ to test.
Test Results:
And it is just simple example, you can provide more detailed information if it can’t help you.
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
Can you provide more detail on what you are trying to accomplish and the layout of the data (parent/child relationships)
Hi Dusyant,
As per my information there is no way to retrieve value without using API in JS.
Please refer below url for more details:
community.dynamics.com/.../retrieve-value-of-lookup-field-from-another-entity
André Arnaud de Cal... 291,711 Super User 2024 Season 2
Martin Dráb 230,458 Most Valuable Professional
nmaenpaa 101,156