I would appreciate any help.!
The problem is that I have to save the record each time to do "mapping fields" works, so "save the record" and create a new contact takes too much time to the user who is going to create thousands of records in a moment.
What alternatives I have to improve the user experience.
Thanks!
Hi,
As mentioned before, the script suggested above is unsupported and may not work in future. The unified interface has different rendering engine which is why the its not working when we are searching by window.top.Frames[0]...
I tried other alternatives but none of them are working in UI :(
I Ravi, how you been?
This is the code that I need to update to UI, would you like to help?
function loadParentDetails2() { try { // Load Account from Parent to Child record var parentAccount = window.top.frames[0].Xrm.Page.getAttribute("new_cuenta").getValue(); Xrm.Page.getAttribute("parentcustomerid").setValue(parentAccount); } catch (err) { console.log(err.message); } }
I have updated my first response amd corrected the code.
The error is becuase I have syntax error in the script... it should be console.log instead of Console.log (small "c").
Change that and you will not see the error any more however the values will also be not set if you openes it from other entity. This is because the first line checks for the field from your parent account entity
Hope this helps.
Hi Ravi,
The Script works fine with the primary entity but when I create a new contact from other entity shows this error.
ReferenceError: Console is not defined at loadParentDetails (sandboxag.crm.dynamics.com/.../new_CuentaAContacto
Hi Ravi,
The Script works fine with the primary entity but when I create a new contact from other entity shows this error.
ReferenceError: Console is not defined at loadParentDetails (sandboxag.crm.dynamics.com/.../new_CuentaAContacto
You are a Saint!. Thank you so much.
Hi,
As you have already noticed that the out of box mapping will only work when the record is saved. This makes sense cause the parent is not saved hence there is no record to pull the data from in database.
Unfortunately there is no supported way to pass the data from parent to child without saving. I tried some unsupported javascript and it seems to be working fine. You can try and see if it works for you. However it is recommended to not use any unsupported code as it *will* break in future.
You need to register this method on load. You also need to replace the field schema values.
=================
function loadParentDetails() {
try {
// Load Account from Parent to Child record
var parentAccount = window.top.frames[0].Xrm.Page.getAttribute("parentaccountid").getValue();
Xrm.Page.getAttribute("parentcustomerid").setValue(parentAccount);
}
catch (err) {
console.log(err.message);
}
}
=====================
Alternatively you could redesign your implementation pass the form data as parameters to form. With this you need to create a separate ribbon button and call the Xrm.Navigation.openForm function to open the child record and pass the data as form parameters.
docs.microsoft.com/.../set-field-values-using-parameters-passed-form
You can refer these thread on this:
community.dynamics.com/.../how-to-pass-parameters-using-openentityform
community.dynamics.com/.../mapping-parameters-when-opening-a-new-form
Hope this helps.
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... 290,900 Super User 2024 Season 2
Martin Dráb 229,275 Most Valuable Professional
nmaenpaa 101,156