- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi Team,
1.Reaching out for guidance on creating a new field in the Finance Request list/report visualization that displays the number of days taken to resolve a request. I have the Created Date and Resolved Date fields available.
Could you please help me understand how this can be configured as a field, similar to existing fields such as Number, Short Description, and Requested For,
2.Also, for the 'Finance Requests - Breached SLA' report, I want Breached = True to be displayed in red and Breached = False to be displayed in green. Please advise how this can be achieved.
Thank you in advance .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hey @YerragondaA3099
Both of your requirements are achievable, although the implementation approach is different for each.
1. Display "Days to Resolve" as a field in the Finance Request List Visualization
Since you already have the Created Date and Resolved Date fields, the recommended approach is to create a field that calculates the difference between the two dates and then include that field in your list visualization.
Option 1: Create a Calculated Field
Create a new Dictionary field on the Finance Request table.
Example:
- Label: Days to Resolve
- Name: u_days_to_resolve
- Type: Integer
- Calculated: True
Example calculation Script :
if (!current.resolved_at)
return '';
var created = new GlideDateTime(current.sys_created_on);
var resolved = new GlideDateTime(current.resolved_at);
var duration = GlideDateTime.subtract(created, resolved);
// Convert milliseconds to days
return Math.floor(duration.getNumericValue() / (1000 * 60 * 60 * 24));Replace resolved_at with the actual field used on your Finance Request table (for example closed_at, u_resolved_date, etc.).
After creating the field:
- Open the Dashboard in Edit mode.
- Select the Finance Requests List visualization.
- Edit the Data Visualization.
- Add Days to Resolve to the displayed columns.
- Save and refresh the dashboard.
The list will then display something similar to:
Number | Short Description | Requested For | State | Assigned To | Days to Resolve |
FINC0004536 | Request... | John Smith | Closed | David | 3 |
FINC0004537 | Request... | Emma | Closed | Alex | 6 |
Option 2: Populate the Field with Business Rule or Flow
If calculated fields are not preferred (for performance or reporting reasons), another common approach is:
- Create an Integer field.
- Populate it when the record is resolved using:
Business Rule
Flow Designer
Script Action
Example:
if (current.resolved_at) {
var created = new GlideDateTime(current.sys_created_on);
var resolved = new GlideDateTime(current.resolved_at);
var duration = GlideDateTime.subtract(created, resolved);
current.u_days_to_resolve =
Math.floor(duration.getNumericValue() / (1000 * 60 * 60 * 24));
}This stores the value in the database, making reporting and filtering much faster.
2. Display Breached = True in Red and False in Green
This depends on the visualization capabilities available in your Platform Analytics release.
If Series Colors are Supported
Some chart visualizations allow manual color mapping.
Navigate to:
Visualization
→ Series
→ Colors
Assign:
Value | Color |
False | Green |
True | Red |
Save the visualization.
If Manual Series Colors Are Not Available
Most standard Platform Analytics charts automatically assign colors to categories and do not support conditional colors for Boolean values out of the box.
In that case, there are several alternatives.
Alternative 1
Instead of reporting directly on the Boolean field, create a derived or choice field.
Example values:
Breached
Not Breached
Then configure:
Breached → Red
Not Breached → Green
This generally provides better control over chart colors.
Alternative 2
If you're using Score widgets or KPI widgets, you can use Threshold Colors:
Presentation
→ Thresholds
However, thresholds work best with numeric values rather than Boolean fields.
Alternative 3
If you're building the dashboard in UI Builder or using a custom visualization, you can define custom color mappings through the component configuration or custom code. This provides complete control over the chart colors but requires additional customization.
Recommendation
For your first requirement, I recommend creating a Days to Resolve field (either calculated or populated when the request is resolved). This makes it easy to display, filter, sort, and report on the value across dashboards.
For the second requirement, first check whether your Platform Analytics visualization supports Series Color Mapping. If it does, simply assign True → Red and False → Green. If that option isn't available in your release, this is a platform limitation for Boolean categories, and the usual workaround is to report against a choice/string field (for example, Breached and Not Breached) or use a custom visualization where category colors can be explicitly configured.
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Hey @YerragondaA3099
Both of your requirements are achievable, although the implementation approach is different for each.
1. Display "Days to Resolve" as a field in the Finance Request List Visualization
Since you already have the Created Date and Resolved Date fields, the recommended approach is to create a field that calculates the difference between the two dates and then include that field in your list visualization.
Option 1: Create a Calculated Field
Create a new Dictionary field on the Finance Request table.
Example:
- Label: Days to Resolve
- Name: u_days_to_resolve
- Type: Integer
- Calculated: True
Example calculation Script :
if (!current.resolved_at)
return '';
var created = new GlideDateTime(current.sys_created_on);
var resolved = new GlideDateTime(current.resolved_at);
var duration = GlideDateTime.subtract(created, resolved);
// Convert milliseconds to days
return Math.floor(duration.getNumericValue() / (1000 * 60 * 60 * 24));Replace resolved_at with the actual field used on your Finance Request table (for example closed_at, u_resolved_date, etc.).
After creating the field:
- Open the Dashboard in Edit mode.
- Select the Finance Requests List visualization.
- Edit the Data Visualization.
- Add Days to Resolve to the displayed columns.
- Save and refresh the dashboard.
The list will then display something similar to:
Number | Short Description | Requested For | State | Assigned To | Days to Resolve |
FINC0004536 | Request... | John Smith | Closed | David | 3 |
FINC0004537 | Request... | Emma | Closed | Alex | 6 |
Option 2: Populate the Field with Business Rule or Flow
If calculated fields are not preferred (for performance or reporting reasons), another common approach is:
- Create an Integer field.
- Populate it when the record is resolved using:
Business Rule
Flow Designer
Script Action
Example:
if (current.resolved_at) {
var created = new GlideDateTime(current.sys_created_on);
var resolved = new GlideDateTime(current.resolved_at);
var duration = GlideDateTime.subtract(created, resolved);
current.u_days_to_resolve =
Math.floor(duration.getNumericValue() / (1000 * 60 * 60 * 24));
}This stores the value in the database, making reporting and filtering much faster.
2. Display Breached = True in Red and False in Green
This depends on the visualization capabilities available in your Platform Analytics release.
If Series Colors are Supported
Some chart visualizations allow manual color mapping.
Navigate to:
Visualization
→ Series
→ Colors
Assign:
Value | Color |
False | Green |
True | Red |
Save the visualization.
If Manual Series Colors Are Not Available
Most standard Platform Analytics charts automatically assign colors to categories and do not support conditional colors for Boolean values out of the box.
In that case, there are several alternatives.
Alternative 1
Instead of reporting directly on the Boolean field, create a derived or choice field.
Example values:
Breached
Not Breached
Then configure:
Breached → Red
Not Breached → Green
This generally provides better control over chart colors.
Alternative 2
If you're using Score widgets or KPI widgets, you can use Threshold Colors:
Presentation
→ Thresholds
However, thresholds work best with numeric values rather than Boolean fields.
Alternative 3
If you're building the dashboard in UI Builder or using a custom visualization, you can define custom color mappings through the component configuration or custom code. This provides complete control over the chart colors but requires additional customization.
Recommendation
For your first requirement, I recommend creating a Days to Resolve field (either calculated or populated when the request is resolved). This makes it easy to display, filter, sort, and report on the value across dashboards.
For the second requirement, first check whether your Platform Analytics visualization supports Series Color Mapping. If it does, simply assign True → Red and False → Green. If that option isn't available in your release, this is a platform limitation for Boolean categories, and the usual workaround is to report against a choice/string field (for example, Breached and Not Breached) or use a custom visualization where category colors can be explicitly configured.
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Servicenow Developer
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
@vaishali231 ,
Thank you so much