Notifications
Announcements
No record found.
Hi,
Iam using window.top.opener.frames[0].Xrm.Page.getAttribute("fieldname").getValue(); to get the parent field value and set in child record. This code works in other browser except in microsoft edge,iam getting scrpit error...Any ideas?
Hi Victoria,
This is an unsupported way as you're accessing the dom. You can use field mapping if there is a relationship between these two entities you're using. You can also make use of ms CRM API to get the data from parent and set it in child record.
docs.microsoft.com/.../map-entity-fields
Hi Sardar Ahmed,
Thank you!
Hi Victoria,
Agree with Sardar that we'd better no manipulate the DOM directly.
In addition, 'frames[0].Xrm.Page' is usually used to access the Xrm.Page object from IE Developer Tools console window.
bingsoft.wordpress.com/.../
So we can't confirm whether it runs well in Edge. Thanks.
Regards
Johnny
Hello Victoria,
Looking at your code, it is not supported, the reason behind is the fact that it uses DOM elementrs.
Here is the documentation behind:
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-javascript#write-javascript-for-multiple-browsers
"
Because you don’t know what browser will be in use, you should make sure that any scripts that you use will work with all supported browsers. Most of the significant differences between Internet Explorer and other browser have to do with HTML and XML DOM manipulation. Because HTML DOM manipulation is not supported, if script logic is only performing supported actions and using the Client API, the changes required to support other browsers could be small.
A cross-browser library like jQuery is a good solution for developing web resources but should not be necessary for form scripts or ribbon commands. More information: Avoid using jQuery for form scripts
The document above is applicable for both online and on premises environments.
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/supported-extensions
Also we have the document above where you can find this part:
"Directly accessing the Document Object Model (DOM) of any Dynamics 365 Customer Engagement (on-premises) application pages is not supported. The use of jQuery in form scripts and commands is not recommended. More information: Client scripting in Customer Engagement (on-premises) using JavaScript"
Both documents apply for online organizations as well.
Here's the document confirming the window.top is part of the DOM:
https://msdn.microsoft.com/en-us/ie/hh772148(v=vs.94)
https://msdn.microsoft.com/en-us/ie/hh772384(v=vs.94)
Inside the document above you will find the window object having the following description:
window
Represents an open window.
Other than this, looking at the code, Xrm.Page is deprecated since about 2 years ago:
https://docs.microsoft.com/en-us/power-platform/important-changes-coming#some-client-apis-are-deprecated
My recommendation is to use formContext.getAttribute(arg).getValue(); based on the document below and to skip the entire set of DOM elements in the beginning of the request:
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/attributes/getvalue#syntax
I hope this helps.
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.
Tom_Gioielli 70 Super User 2025 Season 2
Gerardo RenterÃa Ga... 43 Most Valuable Professional
Daniyal Khaleel 32 Most Valuable Professional