moussa-e
8/16/2016 - 7:57 AM

CRM 2016 #Webresources #JavaScript #CRM2016 #MoussaElAnnan #Xrm

CRM 2016 #Webresources #JavaScript #CRM2016 #MoussaElAnnan #Xrm

//Open an HTML web resource named “new_webResource.htm”
Xrm.Utility.openWebResource("new_webResource.htm");

//Open an HTML web resource including a single item of data for the data parameter
Xrm.Utility.openWebResource("new_webResource.htm","dataItemValue");

//Open an HTML web resource passing multiple values through the data parameter
var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");
Xrm.Utility.openWebResource("new_webResource.htm",customParameters);

//Open an HTML web resource with the parameters expected by HTML web resources
Xrm.Utility.openWebResource("new_webResource.htm?typename=account&userlcid=1033");
 
//Open an HTML web resource, setting the height and width
Xrm.Utility.openWebResource("new_webResource.htm", null, 300,300);
/*
* Function that shows/hides a webresource.
* @params {webresourceName} The webresource name.
* @params {visibility} The webresource name.
*/
showHideWebresource = function(webresourceName, visibility){
    Xrm.Page.getControl(webresourceName).setVisible(visibility);

}
/*
* Function that gets a select control from the webresource..
*/
getSelectFromWebresource = function(){
	var entitySelectMapper = window.parent.Xrm.Page.ui.controls.get(webresourceName);
		var destination = entitySelectMapper.getObject().contentWindow.document;
		if (destination)
		{
			var customControl = destination.getElementById(selectName);
	     	return customControl;
	  	}
}