
Announcements
I am trying to build an application in power apps and in that I am having multiple react component as an iframe but I want to utilize the powerapps dynamic data into react component is there any way that I can pass that data to the iframe dynamically
There is a real hidden method to pass the form context to an IFrame, you can find it here
Basically you have to create a method in your iframe
// This script should be in the HTML web resource.
// No usage of Xrm or formContext should happen until this method is called.
function setClientApiContext(xrm, formContext) {
// Optionally set Xrm and formContext as global variables on the page.
window.Xrm = xrm;
window._formContext = formContext;
// Add script logic here that uses xrm or the formContext.
}and you must implement the following code in you custom javascript called from you form
// This should be in a script loaded on the form.
// form_onload is a handler for the form onload event.
function form_onload(executionContext) {
var formContext = executionContext.getFormContext();
var wrControl = formContext.getControl("new_myWebResource.htm");
if (wrControl) {
wrControl.getContentWindow().then(
function (contentWindow) {
contentWindow.setClientApiContext(Xrm, formContext);
}
)
}
}With this method, you can pass both Xrm and formContext to your iframe, so you can read data from your form or from the database, without having to use parent.Xrm.Page (that is deprecated)