Friday, July 1, 2011

CRM Online :- Setting up an efficient developer environment for SilverLight resources

I've started working on a project where i am supposed to build a silverlight web resource for CRM Online and test it. The Web Resource will use CRM OData APIs to communicate with the CRM Online system and hence it can be tested only once it is hosted within an HTML page which is hosted in a CRM Online as a web Resource. 
Now here are the steps one needs to follow in order to debug this silverlight code..
1) Upload the xap file as a web resource in the CRM Online instance using the Web UI
2) Publish the xap file 
3) Navigate to the html file using the URL 
4) Attach the IE to visual studio and then debug the code by setting break points 


This makes the debugging and developing the applications very tedious since every build means that i have to upload the resource and do navigation as well... 
In order to make this process efficient here is the setup i have done on my machine 


1) Use Web Resource Upload Utility to upload the xap file on CRM Online instance. Now every time you build your solution all you need to do is to click a button to upload and publish the new xap file to CRM Online instance. 
2) In the web project you got created when you create a silverlight project add a new html page where onload of the body redirect the browser to the url where your html file is added. Here's how the code of html might look like...







Set this html page as the startup page when you debug the stuff...


And you are set... 
Now every time you change your code the debug process looks like the following
1) Build the silverlight project and use the web resource upload utility to upload the xap file 
2) Press F5 and the html page you've in your web project will redirect you to CRM Online where your xap is being hosted 


And you are set. I might work on a command line utility to build and publish the xap file on CRM Online instance if it becomes a lengthy project. But for a small POC kind of work this is much more efficient then the normal way one has to follow...


hope this helps 
cheers!
~Abhishek

CRM Online :- How to get the organization name

While working with CRM Online sometimes it is necessary to get the organization name to do some tasks (Like using a Web Resource Upload Utility)
Now in an on premise CRM system the organization name can be found from the URL or from the deployment manager. But there's no such flexibility in case of CRM Online. 
To get the organization unique name you need to go to 
Settings -> Customization -> Developer Resources and there you would find the name of the organization as you can see in the below screenshot. 


This is the organization name you can use to connect to your CRM Online instance with utilities such as Web Resource Upload Utility :)

NJoi!!!

~Abhishek