CRM 2011 Integer fields and comma symbol

In CRM if you create an integer field by default the CRM group 2 numbers together by using a comma. This is the standard feature.

However sometimes customers ask this comma to be removed. This is not possible with OOTB functionality in CRM. You have couple of options.

•    Remove the integer field, have a text field and include javascripting to validate the field. This might be cumbersome.
•    Can create another field (text) and using a workflow assign the value of the integer field to this. This field would be getting displayed in views and forms. The drawback is you have synch both these fields.
•    You can have a javascript to remove the comma from the CRM form when it’s loading. Not much difficult. However you still would not be able to get rid of commas when you display a view.

Below I have given a common javascript function which can be used to get rid of commas. Add this to a web resource.


function RemoveComma(fieldname)
{
document.getElementById(fieldname).value = Xrm.Page.data.entity.attributes.get(fieldname).getValue();
}

•    Add the web resource to form onload event.
•    Call the function RemoveComma with the field name as the parameter.


This way you can use this function anywhere you want just by passing the field name to it.

Comments

Popular posts from this blog

Error message “User does not have send-as privilege.” when sending emails programmatically in CRM 2011