In my dataverse model driven app I have an entity "order" and an entity "issue".
The relationship between them is N to 1 ie multiple orders, 1 issue.
If I am creating a new order from the main order form there is a lookup field to "issue". I can either select an existing "issue" or (if required) create a new one using the quick create form.
When using the quick create form I would like the field "account" to automatically populate from what is on the order form. I can see how to map from parent entity "issue" to child entiy "order" but understand you can not create mapping from child entity to parent entity.
I have read some blogs on how to do this using js and local storage but the local storage option sounds like it may be a little unreliable.
Any help on the best way to handle this would be really helpful. Thankyou.
@a33ik 's code just gets you the "parent" record (in your case, the Issue). From there, you need to do a retrieveRecord call using the client script API to get the accountid value. It would look something like this:
Xrm.WebApi.retrieveRecord(parentRecordReference.entityType, parentRecordReference.id, "?$select=accountid").then(
(success) => {console.log(success.accountid)},
(error) => {console.error(error.message)}
);
Thanks, I have had a look at your code (pasted below).
Hello,
You can check my post - https://butenko.pro/2020/09/15/js-how-to-get-the-originating-record-reference-in-the-form-script-of-the-quick-create-form/
In the post I described on how to get the parent entity and using WebApi and some JavaScript you can populate the lookup from the parent entity.
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1