Thursday 26 June 2014

Use form properties on an external web-resource in CRM Dynamics 2013


I assume that you have read my previous post and now you would like to bind the attached web resource to some information coming from the calling form, no?
This is supported out-of-the-box in CRM Dynamics 2011 as well as in 2013, but not automatically activated. To activate this feature, you will need to edit the customizations XML file.
Go find the solution that you have been working on and export it, making sure that the customizations option is checked:
image

save the zip file somewhere and unzip it. Then open the customizations.xml file with your favorite xml editor, in my case notepad++ (it rocks!). Search in there for NavBarItem and select the one that corresponds to the navigation link that you have inserted in the form. After you have found it, add PassParams=”1” to its properties, then save and close the xml.
image
Make sure you create a new zip file with all the files that came from the one that you have unzipped. Afterwards, import the zip file back to your CRM as a solution file (Import Solution). Publish the newly imported solution.
What we have achieved at this point is that the form that contains the navigation link to our new websource will willingly forward some properties to the new websource regarding its content. To access this information, make sure that your html websource references the clientGlobalContext.js.aspx correctly:
<script type="text/javascript" src="..../ClientGlobalContext.js.aspx"></script>
and then, you can access those properties with the use of GetGlobalContext().getQueryStringParameters() within a script tag.
Here is an idea of the info that the form passes:
image 

I hope you find this useful. Let me know what you think.

No comments:

Post a Comment