Skip to content Skip to sidebar Skip to footer

Passing Dynamic Parameter (field Values) To Webresource On Dynamics Crm Using Custom Parameter (data)

Can't get the values into the querystring of the webresource iframe url. I add the field name (schema name) to the custom parameter (data) and get the field name on the querystring

Solution 1:

Even though there are posts saying you can pass dynamic values to the custom parameter (data) of the webresource, my experience is the same as Adi's above, that those parameter are only for static values.

In that case the easiest alternative I found to get the values of the form fields into the webresource are even simpler than what I was trying to do. By just adding: window.parent. you get access to Xrm.Page. So all you have to do is:

var formfieldValue = window.parent.Xrm.Page.getAttribute("CRMFieldSchemaName").getValue();

Don't forget to place it within a javascript tag on the webresource:

<scripttype="text/javascript">
  $(function () {
     var formfieldValue = window.parent.Xrm.Page.getAttribute("CRMFieldSchemaName").getValue();
  });
</script>

Solution 2:

That box is for static values. To make it dynamic you need to construct the IFRAME URL using Javascript.

I used XrmIframe as framework in order to make Iframe coding simple. The important part happens in the OnLoad Event.

Keep in mind that this is just a basic example.

//SDK Iframe helper examplefunctionXrmIframe(sId) {
    if (sId == undefined) return;

    var xiObject = this;
    xiObject.Ctl = Xrm.Page.getControl(sId);

    xiObject.Get = function () { 
        return xiObject.Ctl.getSrc(); 
    }

    xiObject.Set = function (sUrl) { 
        xiObject.Ctl.setSrc(sUrl); 
        return xiObject; 
    }               
}

//entity onload jsvar myIframe;
functionOnLoad() {
    //construct iframe
    myIframe = newXrmIframe("IFRAME_Test");
    //load iframe
    myIframe.Set("construct url with dynamic values here...")
}

Post a Comment for "Passing Dynamic Parameter (field Values) To Webresource On Dynamics Crm Using Custom Parameter (data)"