Archives by Tag 'jscript'
Lookup a lookup on another entity using JScript
Do you need the value of a lookup? I have written this bit of code to look a lookup value stored on another entity. Like finding the Customer lookup on an Incident (Case). Here is a bit of code that can lookup a lookup on any entity in CRM.
Click to continue reading
Click Here To View Post With Syntax Highlighting
CRM Common Javascript File
Need to reference an external javascript file to make functions available in change events and in an onload? Here’s how!
Click to continue reading
Click Here To View Post With Syntax Highlighting
Changing PickList Values on Yes/No Form Field Change
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.
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.
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
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
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