Thursday, December 9, 2010

ISVConfig/SiteMap Tip #1: Point to an ASPX page to extend functionality

So far it's been about 2 months since I've been working with the CRM 2011 Beta and while many things have changed drastically, the SiteMap and ISVConfig still adhere to the same rules as in CRM 4.

When creating a link for the Workplace I prefer to use an ASPX page as opposed to a JS page or otherwise. The reason I use it is not only can I embed JS I can also render my own webpages, silverlight controls, etc.

In a real world example,  you are tasked with creating a link in the workplace that not only points to the Active View of the desired entity but also opens a new window that allows you to create an instance of that particular entity. I pointed my SiteMap to an ASPX page that simply ran JS onLoad:

<beginscript language="javascript" type="text/javascript">
//Open popup and set location using CRM global var
window.open('/' + parent.top.ORG_UNIQUE_NAME + '/userdefined/edit.aspx?etc=10002', null);
window.location.href =
'/' + parent.top.ORG_UNIQUE_NAME + '/_root/homepage.aspx?etc=10002&pagemode=iframe';</endscript>


*Note: Replace the begin and endscript tags with script. Blogger apparently doesn't like that tag!

However if I needed some silverlight or a webpage I can easily modify the ASPX page outside of CRM and not have to worry about importing. Using this method provides me enough abstraction to pretty much do what I want.

Tips about the code above:
  • Using the CRM provided JS variables helps out tremendously. Familiarize yourself with them!
  • The pagemode=iframe parameter in the url will give you the correct view to show in the window.location. It removes the ribbon and anything else besides the core view.