Wednesday, March 25, 2015

Remove comma from number fields in CRM 2011

By default, the Whole Number Format in MSCRM uses the global number format setting and cannot be overridden at the field level.

We can control it via System and User Settings.

System Setting :-
Move to Settings-> Administration-> System Settings-> Format Tab

In the format tab click the Customize button as shown in pic below:


Now all you need to do is change the Digit Grouping Symbol and Digit group.


NOTE: This will change the format for each and every number field in CRM 2011 form including the currency grouping format as well.


But this change will reflect only for new users, but won’t reflect on existing users.
To reflect for the existing users, you need to change user settings.

User Setting :-
Move to File-> Options -> Format Tab

This will open a window as in system settings and you need to follow same steps.

But you cannot log in to all the user accounts. Hence we can update user settings by using following script.

UPDATE [CRMDB].[dbo].[UserSettingsBase]
SET [NumberGroupFormat] = 0


If you don't want to remove comma in all the whole number fields, you can use following javascript to remove the comma in CRM forms.
But this works only for form fields not on views.

document.getElementById("fieldname").value = Xrm.Page.data.entity.attributes.get("fieldname").getValue();

No comments:

Post a Comment