Picture on a CRM 2011 form - Using WebResource

by asomat 15. October 2012 08:23
null [More]

Redirect IFrame Content

by Chuck Oldes, MCT, MCTS, MCSE 3. August 2012 08:47
One of the advantages of MS CRM 2011 is the introduction of Web Resources, which allows you to reuse JavaScript across mulitple Entities. By centralizing code that can be reused you reduce the amount of custom code that needs to be maintained and in this example you can create a function that completes the same procedure but allows for flexibility. In this example we want to centrally control the URL use by IFRAME located in different Entities. First  step is to build a function that would allow for changing the URL based on variables being passed into the function.   Create a Web Resoucre JavaScript  using the below code   var url1 = "http://sharepoint/sites/site1/Shared%20Documents/ "; var url2 = “http://sharepoint/sites/site2/Shared%20Documents/";   function setIFrameSrc(IFrameName, ChangeContentURL) {                 if (!isNullOrEmptyString(IFrameName) && !isNullOrEmptyString(url) && !isNullOrEmptyString(value)) {                                 var iFrame = Xrm.Page.getControl(IFrameName);                                 if (iFrame != null && iFrame.getVisible()) {                                                 if (typeof (ChangeContentURL) !== "undefined" && ChangeContentURL && !isNullOrEmptyString(url2)) {                                                                 url1 = url2                                                 }                                                 iFrame.setSrc(url 1);                                 }                 } }     Once you have the Script created with the function that was outlined above ensure that you load it above the Script in which you are going to invoke it.       From the OnLoad event of a entity you can invoke function with a simple call. To load url1 do not add in a ChangeContentURL value as part of invoking the function.   setIFrameSrc("IFRAME_Documents");   Changing the URL you simply have to add a value as part of invoking the function. By passing a true into the ChangeContentURL variable in the function it will step into the if statement and change to url2.   setIFrameSrc("IFRAME_Documents", true);  

Tags: , , , , , ,

Categories: CRM 5.0 | JavaScript

Redirect IFrame Content

by Webfortis 7. May 2012 07:59
One of the advantages of MS CRM 2011 is the introduction of Web Resources, which allows you to reuse JavaScript across mulitple Entities. By centralizing code that can be reused you reduce the amount of custom code that needs to be maintained and in this example you can create a function that completes the same procedure but allows for flexibility. In this example we want to centrally control the URL use by IFRAME located in different Entities. First  step is to build a function that would allow for changing the URL based on variables being passed into the function.   Create a Web Resoucre JavaScript  using the below code   var url1 = "http://sharepoint/sites/site1/Shared%20Documents/ "; var url2 = “http://sharepoint/sites/site2/Shared%20Documents/";   function setIFrameSrc(IFrameName, ChangeContentURL) {                 if (!isNullOrEmptyString(IFrameName) && !isNullOrEmptyString(url) && !isNullOrEmptyString(value)) {                                 var iFrame = Xrm.Page.getControl(IFrameName);                                 if (iFrame != null && iFrame.getVisible()) {                                                 if (typeof (ChangeContentURL) !== "undefined" && ChangeContentURL && !isNullOrEmptyString(url2)) {                                                                 url1 = url2                                                 }                                                 iFrame.setSrc(url 1);                                 }                 } }     Once you have the Script created with the function that was outlined above ensure that you load it above the Script in which you are going to invoke it.       From the OnLoad event of a entity you can invoke function with a simple call. To load url1 do not add in a ChangeContentURL value as part of invoking the function.   setIFrameSrc("IFRAME_Documents");   Changing the URL you simply have to add a value as part of invoking the function. By passing a true into the ChangeContentURL variable in the function it will step into the if statement and change to url2.   setIFrameSrc("IFRAME_Documents", true);      

Tags: , , , , , ,

Categories: Dynamics CRM | JavaScript | Webfortis

Month List