Monthly Archives: September 2010

Using common JS files in MS CRM 2011

Every MS CRM implementation requires lot’s of JS code to implement validation and business logic using client side. As you know we can call MS CRM web services in JS to retrieve MS CRM data and insert ms crm data. But in MS CRM 4.0 there was no way to share JS code indifferent entities forms in supported way. You can create JS library in and load it in different ms crm entities forms, but it is unsupported in MS CRM 4.0. I have faced many issues while using external JS files in one of my MS CRM 4.0 implementations.

But now no need to worry about external JS files, MS CRM 2011 provide provides you OOB facility to use Common JS libraries in term of web resources. You can load your JS files using web resource, once loaded you can call your JS functions that are available in JS files. You can configure ms crm entity and attributes events to call this function and also you can pass parameter to that function. Thanks to Ayaz Ahmad, he has written a wonderful Post to demonstrate, how to use JS libraries in MS Dynamics 2011.

And If you are worried about how to convert your existing MS CRM 4.0 JS code to Dynamics 2011 JS code then here is a wonderful tool that you can use to upgrade your MS CRM 4.0 JS code to MS CRM 2011.

You can download MS CRM 2011 SDK  for more Client-Side Programming Reference

Source :

  http://ayazahmad.wordpress.com/2010/09/25/javascript-libraries-in-microsoft-dynamics-crm-2011/

 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0c7dcc45-9d41-4e2e-8126-895517b4274c

 http://crm2011scriptconvert.codeplex.com/

Leave a comment

Filed under MS CRM 2011

Run exe from MS CRM 4.0

If you are looking to run .exe from MS CRM 4.0, then you can do this easily. You can create a ISV button on MS CRM form and create on global function on formonload can call it in ISV button JS.. you can write below code to run .exe

var _Object=new ActiveXObject( “WScript.Shell” ) ;
_Object.Run(“C:\\WINDOWS\\system32\\calc.exe” );

 you can also pass parameters with Run command.

Enjoy !!!

4 Comments

Filed under JS Script, MS CRM 4.0

Watch Dynamics CRM 2011 Beta Videos

Great link to watch Dynamics CRM 2011 Beta Viedeos

http://offers.crmchoice.com/CRM2011Beta-Developer-Videos/

Enjoy !!!

Leave a comment

Filed under MS CRM 2011

Easy way to avoid Infinite loop in Update plugin

I have seen many developers facing issue of infinite loop while using update method inside update plugin. I know it could be requirement specific, to use update method inside update plugin. But sometime we can void infinite issue, there is no need of calling update method. You could play with inputparmeter propertybag. For example sometime we have requirement to calculate values based on the input values scenarios like this we don’t need to use update method. So the question is how to update record without using update method in update plugin. For scenarios like these we can register our plugin on pre state and can catch our inputs from inputpropertybag and after calculating our values we can add our new property of resultant value in inputpropertybag, so no need of using update method to save value in database.

We need to follow below steps

  1. Register preupdate plugin.
  2. Read required input values from inputparameter propertybag.
  3. Calculate your resultant value.
  4. Create new property of your resultant value.
  5. Add new property to input propertybag.

Enjoy !!!

Leave a comment

Filed under MS CRM 4.0, Workflow & Plugin Development

Close Activity Event in MS CRM

sometime we need to perform some action when activity is closed in MS CRM.In that case you have to capture close activity event, you can do this using event.Mode property in onsave event. you just have to write below code.

if(event.Mode==5) //Close activity event

{

//you code to implement your logic

}

Enjoy !!!

Leave a comment

Filed under JS Script, MS CRM & Javascript, MS CRM 4.0

Attach onclick event with MS CRM CRM checkbox

As you know that we can set control formatting of bit field to use it as checkbox. But only changing formatting does not make it to behave like a checkbox because of onchange event. Let take an example for this, like we have one field “Calculate Value” and we want to calculate some value on the selection of this bit field. We can set control formatting for the bit field to display like a checkbox.

 So if we will write some code onchange event of this bit field

alert(‘Clicked’);

You will not get this alert until you will move focus from this field. so make it to behave like real checkbox you have to attach onclick event with this field. You can do this using below code on form onload

crmForm.all.new_calculatevalue.onclick=function()

{

alert(‘Clicked’);

 }

after that you can simple check DataValue for bit ,if it is true or false to work accordingly

 Enjoy!!

1 Comment

Filed under JS Script, MS CRM 4.0