- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2017 08:03 PM
Is there a way i can show a calculated field value in a list view, i've tried through business rules and the calculated value it self and i am not able to see it once switched to the list view only when i view each individual record.
The use case is when we need to bill someone for an over usage of something i need that last value that needs to be billed a calculated value based on the overage amount and the overage price so that multiple records can be seen/selected at once of all the overage prices and execute a custom ui action on all those rows.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2017 09:33 PM
If I am understanding your requirements correctly, the only thing you can do is create a new table that joins the tables together with a pseudo calculated field as shown in my example.
New Table
Field 1: Reference table A
Field 2: Reference table B
Field 3: You field calculated via business logic
Create before update/insert business rule to populate value of field 3.
Dot walk as required to show fields on table A or B in the list.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2017 09:16 PM
Database views can only be used for joining tables.
It doesn't handle calculations or logic of any kind.
'Calculated fields' are essentially virtual, so they cannot work in DB views.
You will need to use some sort of external reporting solution.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2017 09:27 PM
Right so back to my orginal question, what is the best way to do what i am trying to accomplish leveraging the full use of the product. I need a solution not regeritaed roadblocks and common KB answers please.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2017 09:33 PM
If I am understanding your requirements correctly, the only thing you can do is create a new table that joins the tables together with a pseudo calculated field as shown in my example.
New Table
Field 1: Reference table A
Field 2: Reference table B
Field 3: You field calculated via business logic
Create before update/insert business rule to populate value of field 3.
Dot walk as required to show fields on table A or B in the list.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 02:36 PM
Thank you very much for this , i think i understand the approach i'll try this out. So once i have the raw data i would have a UI action to write to this third table to give me a proper bill ? I am understanding that fully?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2017 04:25 PM
So i think this solution works but i am getting a duplicate key issue
Unique Key violation detected by database (Duplicate entry '9d42abfbdb50b6005524fbec0f96196e' for key 'PRIMARY')
(function executeRule(current, previous /*null when async*/) {
var bwOver = current.u_raw_95th_data.u_total_used - current.u_master_95th_table.u_bandwidth_purchased;
if(bwOver > 0) {
current.u_bandwidth_overage = bwOver;
current.u_overage_bill = current.u_master_95th_table.u_overage_bandwidth_price * bwOver;
} else {
current.u_bandwidth_overage = 0;
}
current.update();
})(current, previous);