Like Calculated Fields, but easier and allowing more flexibility…

General Add comments

Would it not be handy to have a way to fill in a field based on some rules in combination with existing field values? Kind of the functionality you can achieve with Calculated Fields?
For example a naming convention to determine the name of a CI, and also in a flexible way?

In this blog article a solution will be demonstrated with the corresponding update set at the end to deploy it on your own instance.
It introduces more flexibility than out-of-the-box Calculated Fields in ServiceNow and can be used on multiple tables/fields without the need for specific scripting – as would be required when using Calculated Fields. It’s all managed from just 2 tables.

The solution consists of the following functionality

Functionality Name
Table Name Convention (u_name_conv)

  • u_table (string – table_name)
  • u_field (string)
Table Name Convention values (u_name_conv_val)

  • u_name_conv (reference)
  • u_type (choice)
  • u_value (string)
  • u_order (string)
Script Include ExtNumbMaint
Business Rule useNumbMaint
UI Action Tidy up order

In the table “Name Convention” and “Name Convention Values” all the logic for the naming is determined and registered. The “Name Convention” stores the table and the field on which you want to perform the name convention. The “Name Convention Values” table defines the values you want to use and in which order you want to use them. There are two ways to determine a value:

  • fixed-value

Fixed-value is a hard coded text string which can be defined freely by the user

  • field

Field is a value determined based on the value in a field. The field must be on the table defined on the Name Convention record, either a reference or a field. At this moment it does not support many relationships. An example could be the userid of the Caller reference field on an incident.

Now let’s look at a little demo on how this works in practice. In my example I will use the incident table and the field short description.
I will fill this field with the following text: “This is a test –  <Incident number> – reported by – <User name of the Caller>.”

First define a new “Name Convention” record. In the Application Name Convention:

Then we have to define the values we are going to use for the filling of the short description. In this case we are going to make the following records:

  • fixed-value => This is a test, order 1
  • fixed-value => – , order 10
  • field => number, order 100
  • fixed-value => – , order 1,000
  • fixed-value => reported by, order 10,000
  • fixed-value => – , order 11,000
  • field => caller_id.user_name, order 12000
  • fixed-value => ., order 13,000

The strange ordering is to demo a UI Action which is going to order the values.

In the context menu there is Action called “Tidy up order”, this will remove all the gaps in the order field. See the screenshot included below.

Now the master data is defined, but let’s check how things look when a new incident is inserted and updated.
You can see that in the screenshots below for a creation and update that is performed.



This is working fine – right?
But now you might be thinking: I want to use this on other tables.
So how can I extend this functionality to other tables?
Well, these are the steps to follow:

  • Copy the business rule useNumbMaint to the table on which you would like to have this functionality.
  • Define the name convention for a field on the Name Convention table and define the values you want to use to fill that field in the Name Convention Values related list

That’s all! 🙂
See an example of the name of a windows server composed based on the Assettag and the name Model ID.

I hope you like this functionality, and please let me know your opinion.
You can reach me via email on .img[at].img.

You can download a zip file containing an Update Set using the download button below.

2 Responses to “Like Calculated Fields, but easier and allowing more flexibility…”

  1. Brit Williams Says:


    May I have a copy of said update set. There’s no download button on this form.


  2. Wouter de Waal Says:

    Hi Brit!
    The ZIP file is updated and can be downloaded here:

Leave a Reply