Monday, October 25, 2010

Web Resource manager in Microsoft Dynamics CRM 2011

You'll find a lot of flexibility while managing code Resources(such as JS,CSS,XAP etc) at Microsoft Dynamics CRM 2011.
Adding a Java script code in CRM 2011 is quite simple however, when it comes to complex projects combining several team members I find it inefficient for example:
The single developer is required to update & publish the code on his CRM-form back & forth without the ability to debug his code along the way.
This intuitiveness will serve well a single developer or a very small team.

The following example will demonstrate how to add a JS code to the contact form:
1.      Create  Java script file names contact.js














Copy the next code to your file
function formOnLoad(){
            alert(‘onLoad’);
}

function formOnSave(){
            alert(‘onSave’);
}

2.      Select in nav bar the defualt solution.








3.      Select Web resource. From this place can be add the files which CRM support to load.







4. Add Java script file to solution.













5.  Default solution contains a new web resource from JS type









6.      Adding Java Script resource to Contact Entity.
Select in solution entities - > contact - > Forms














7.      Select Main Form and press double click for editing











8.      Press Form Properties to attach JS file  + function to form












9.      Open Form Properties section Form Libraries to link between web resource to Contact Entity













10.  Link between Web resources to Contact. CRM allow adding more the one file.

















11. Attach event between Contact entity events onLoad + onSave to custom JS














 







12. Publish the changes and open Contact Form.
In onload get custom alert + in saved mode get custom alert




























   13. CRM Save the Web resource template in table: WebresourceBase.

Thanks,
Rami Heleg

No comments:

Post a Comment