NTBuddy

A place to learn about Microsoft SharePoint and Microsoft Dynamics CRM

Common JScript Routines

Here are some of the mroe common JScript routines that I run and utilize on a weekly basis in my CRM JScript functions.

__.toUpperCase();

Convert to UPPERCASE

__.toLowerCase();

Convert to lowercase

__.replace(/[ ]+$/, '');

Trim all characters to the right

var profits=2489.8237
profits.toFixed(3) //returns 2489.824 (round up)
profits.toFixed(2) //returns 2489.82
profits.toFixed(7) //returns 2489.8237000 (padding)

Format Numbers (Fixed)

var anumber=123.45
anumber.toPrecision(6) //returns 123.450 (padding)
anumber.toPrecision(4) //returns 123.5 (round up)
anumber.toPrecision(2) //returns 1.2e+2 (you figure it out!)

Format Numbers (Precision)

crmForm.ObjectId

Get current form GUID from URL