ere’s a quick post on a simple topic that should save people some frustration. I’ve seen questions for a while now about setting up the number of decimal places for a field in ServiceNow. ServiceNow has a ‘Decimal’ field type that can be used for this, but that field type limits you to no more than two decimal places unless you understand the trick to adding more. In this post I’ll show you the trick to controlling the number of decimal places for a decimal field in ServiceNow.
The first step is to set up your decimal field. You can do this by personalizing the form or list for the table where you need the decimal field. The new field type should be ‘Decimal’ as shown in the screenshot below.
Now for the important part! When a decimal field is created it is set up with a ‘Max length’ value of 15. You can verify this by personalizing the dictionary for your new field. This also means that your decimal field is limited to NO MORE THAN 2 DECIMAL PLACES BY DEFAULT. If you want to extend that, you need to make a couple of adjustments to the dictionary entry for your field.
If you’re not there already, open the dictionary entry for the field by right-clicking the decimal field label and selecting ‘Personalize -> Dictionary’. Once there, you’ll need to adjust both the ‘Max length’ and ‘Attributes’ fields as shown below. The decimal places are a combination of ‘Max length’ and the ‘scale’ attribute. If you want 4 decimal places, you’ll need a ‘Max length’ of 4 plus the default of 15, or 19. Your ‘scale’ attribute would be set to 4, to indicate the number of decimal places. 6 decimal places would require a max length of 21 and a scale attribute of 6, and so on.