How to add a calculated field for a newbie

scotty81
Kilo Contributor

Hi,

 

I'm looking on some basic "how to" to add a calculated field to a table.   I know a bit of how to do this, but I did not find anything like this in the Wiki.   I've got the Eureka version.   I know that generally one creates a new field on the form view and then specifies exactly what the calculation field does in the dictionary entry. I also know some basic scripting syntax.

 

For simplicity's sake, let's say I want to calculate the duration between the open and close of a ticket.   I know that this already exists, but I'm just using it as an example.   By the time I get to the corresponding dictionary entry for my calculated field, I knew to click on the tab that said something like "Calculations" to actually enter my script.   But, in the particular calculated field I created, that did not happen.   I navigated to the appropriate dictionary entry, and instead of there being a tab inside that entry called 'Calculations', there was a tab there instead that said 'Default Value'.   So, that tells me that somewhere I did not tell Service Now that I want to enter a calculation, not just a value for this new field I want to create.

 

Can anyone tell me where one sets this?   I'm sure the part of what I'm missing is rather a simple configuration step, but I haven't figured out a way to get this to work.

 

Thanks in advance.

 

Scotty

5 REPLIES 5

thisismichaelb
Tera Contributor

For closure/resolution durations, I typically use the script here:   Setting the Duration Field Value - ServiceNow Wiki


Kalaiarasan Pus
Giga Sage

Click the advanced view link to see the fields related to calculation



More info


http://wiki.servicenow.com/index.php?title=System_Dictionary


Jim Coyne
Kilo Patron

I would not use a Calculated Field for this, but create a Business Rule instead.   To quote a friend, Capa JC, Calculated Fields are evil!!!



Calculated fields are calculated every time a row is read, whereas the BR will only run when needed.   You can setup the BR to run when required to update the field.


Super like. They are evil indeed I must have told that in my initial response .Thanks Jim