Archives by Tag 'javascript'

Changing PickList Values on Yes/No Form Field Change

By Carlton Colter - Last updated: Saturday, October 3, 2009

Recently on the Microsoft forums someone asked how to change the values of a picklist based on the yes no value of a boolean field. Just add this script to the OnChange event of the yes/no field.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Set a default email template for new emails on cases.

By Carlton Colter - Last updated: Friday, October 2, 2009

In response to Peter Bergman’s post on the CRM forums, I traversed Microsoft’s code. I determined that the ApplyTemplate loads a specific page, and on that page, the ok button sets the information on the calling page. I melded the ApplyTemplate and ok methods together to create LoadTemplate provided below. With the right parameters, it will set the default template.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Remove special characters on value change.

By Carlton Colter - Last updated: Thursday, October 1, 2009

This blog entry contains some helpful information about removing special characters from a string using javascript. I was able to modify it to be just a few of code in an onchange event. Just rename new_name to the attribute your correcting.

if (crmForm.all.new_name.DataValue && crmForm.all.new_name.DataValue.length >0)
{
crmForm.all.new_name.DataValue = crmForm.all.new_name.DataValue.replace(/[^a-zA-Z 0-9]+/g,'');
}

Click Here To View Post With Syntax Highlighting

Get Current User’s Business Unit for Hiding Fields

By Carlton Colter - Last updated: Wednesday, September 30, 2009

In my previous post about hiding fields and tabs using roles, I outlined how use roles to hide fields, etc. Here is a modification of the method to hide sections by business unit.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Hide Fields or Tabs by Role with Javascript

By Carlton Colter - Last updated: Wednesday, September 30, 2009

Do you need to hide fields or tabs based on security roles. Here is an easy way to add the functionality to your CRM, use my code example.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Auto-Update Duration/End Time JScript

By Carlton Colter - Last updated: Monday, September 28, 2009

Sometimes you need to be able to have preset values, and have the duration auto-update. In this example, I will make the actual durations auto-update when one of the fields is changed. If the duration is changed, then the end date will be changed.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Toggle Fields in a CRM form using Javascript

By Stephan Bayer - Last updated: Wednesday, August 26, 2009

This script can be used to create a form in CRM that has fields appear based on a a radio (bit) yes/no. If yes, answer an additional question, if no, keep the other field hidden.

Click to continue reading
Click Here To View Post With Syntax Highlighting

Change CRM Address State to a drop down box.

By Carlton Colter - Last updated: Monday, May 11, 2009

Do you want a drop down box for the state, but you don’t want to break core CRM functionality? This little onload script will show the states for the United States and Canada (You can always modify it to have more options). This will help restrict what people put in the state field by providing them a drop down box. It will also allow them to view the old text box and enter any custom information just by clicking on ‘* ENTER A CUSTOM PROVINCE *’.

Click to continue reading
Click Here To View Post With Syntax Highlighting