Summary:

By default, numeric fields in Sage CRM (fields with an EntryType of 32) are not displayed using separators of for multiples of 1,000. Separators are only used for Currency fields within the system.

Customers may wish to use thousand separators in the product; these can be added using a straightforward custom JS script.

 

Customisation:

The customisation can be added by saving the following to a JS file in the \CRM\WWWRoot\js\custom\ directory:

 

// This example adds thousand separators to all fields on-screen with an
// EntryType value of 32 (numeric). The script can be modified fairly
// easily so that a list of field names can be used instead.
 
// Source separator script:
// http://www.mredkj.com/javascript/numberFormat.html#addcommas
 
function addCommas(nStr, tSep, dSep) {
 
    nStr += '';
    x = nStr.split(dSep);
    x1 = x[0];
    x2 = x.length > 1 ? dSep + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
 
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + tSep + '$2');
    }
    return x1 + x2;
}
 
crm.ready(function () {
 
    var crmMode = "unknown";

    // Use the user’s preferred thousand and decimal separators
    var thousandSep = CurrentUser.userpref_thousandseparator;
    var decimalSep = CurrentUser.userpref_decimalpoint;
 
    $("input[name^='_HIDDEN'][entrytype='32']").each(function () {
 
        // crm(field).val(value) only works in Edit mode, so we need jQuery
 
        if (crmMode == "unknown") {
   
            var tempFieldName = this.name.replace("_HIDDEN", "");
            crmMode = crm(tempFieldName).getMode();   
        }
 
        if (crmMode == "view") {
   
            var tempFieldId = "#" + this.name.replace("_HIDDEN", "_Data");
            $(tempFieldId).text(addCommas($(tempFieldId).text(), thousandSep, decimalSep));
        }
    });
});



More information:

Despite the name of the addCommas function in the code, the above script will work with whatever thousand and decimal separator that hte user has set up under My CRM | Preferences.

An enhancement request has been raised to the product management team for numeric fields in Sage CRM to use comma separators by default.