Add Validation to the Resolve Case button in CRM 2011

Posted: June 6, 2012 in CRM 2011, Jscripts

Validating the Resolve Case button using JScript

When you click on Resolve Case button in CRM, that will trigger onsave event of your Case entity. So add your validation code there.

Check pass the execution context as a parameter checkbox in the Handler properties as shown below

function onSave(context) {
   if (context != null && context.getEventArgs() != null) {
      var saveMode = context.getEventArgs().getSaveMode();
      if(saveMode == "5"){ // 5 is for Resolve Case
         // Add your code here
      }     
   }
}

Different Event Modes in Case
1)  Resolve Case – 5
2)  Cancel Case – 40
3)  Reactivate Case – 6

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s