Hi all
I want to pass values from main form to lookp's new form. For Example: There is a Property entity form that has two lookup fields:
1. Account
2. Bank details
Select account and than going to select bank details that was filtered on change of account. If I found account that has no bank details than I go to the create new bank details from the look up form. At this point I want to pass account on bank detail's form. Is there anyway to do so?
Thanks
Regards,
Abdul
*This post is locked for comments
Hi Abdul,
You can try this : https://passion4dynamics.com/2019/03/12/populate-data-to-parent-records-quick-create-form-in-dynamics-365/
Here are details:
May You please elaborate it more?
Thanks
Regards,
Abdul
Hi, Can you please share error details.
Hi Goutam,
Thank you so much for this great response. I have only one question here. If I open bank details form directly it will give me error. How can I handle this error? Is there any way to check window.open is null or something else?
Thanks
Regards,
Abdul
Hi ,
You can not pass any parameter directly from lookup field New button , however once its open the bank account details forms you can get the parent main form Account lokup using window.parent.opener.Xrm.Page.getAttribute
So below is the sample code you need to write onload of the BankDetails create forms .
function setLookupValueGetFromParent() {
if (Xrm.Page.ui.getFormType() == 1) { // For create Form var parentLookupObj = window.parent.opener.Xrm.Page.getAttribute("new_accountlkup"); //Ge Parent lookup object if (parentLookupObj != null) { if (window.parent.opener.Xrm.Page.getAttribute("new_parentaccountlkup").getValue() != null) { var accountid = window.parent.opener.Xrm.Page.getAttribute("new_parentaccountlkup").getValue()[0].id; // Get the parent form account lookup id var accountname = window.parent.opener.Xrm.Page.getAttribute("new_parentaccountlkup").getValue()[0].name; // Get the parent form account lookup name var lookupValue = new Array(); lookupValue[0] = new Object(); lookupValue[0].id = accountid; // GUID of the lookup id lookupValue[0].name = accountname; // Name of the lookup lookupValue[0].entityType = "bankaccount"; //Entity name of the lookup entity Xrm.Page.getAttribute("new_accountlookupfieldname").setValue(lookupValue); // Replace the lookup id of account in bank account details page } }
} }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156