Wednesday, May 31, 2017

How to Display Custom icon images on Incident Form and in List View in Service Now

This blog explains how to display special icons on Incident form (Caller field) based on user profile settings.

Example :

If 'Affected Person' belongs to 'VIP' then display 'VIP' icon image in 'Users' List view as well as on 'Incident' form

Solution

- Create a Client Script as shown below



- Upload the required icon image to System UI -> Images
- Write down below code under script.

if (caller.vip == 'true') {
callerLabel.setStyle({backgroundImage: "url(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
}
- Whenever 'Affected Person' field value is selected, if the selected user belongs to 'VIP' then 'VIP' flag will be shown on Incident as shown below.



- To display the icons in List view , Below are the steps
- Goto Sytem UI -> Field Styles
- Create new one as shown below



- Below is how shown in List view.









Tuesday, May 30, 2017

How to modify the favcon Icon in Service Now Portal and Console

This blog explains about how to modify the 'Favcon' icon in Service Now Portal


Solution

1. Open Active Service Portals ( Service Portals -> Portals)

2. Click on 'Icon' , Select the .gif image that you wanted to use as a favcon

3. Save



Follow below steps to add favcon in Service Now Instance

1. System UI -> Images
2. Add a image , which you wanted to display as favcon
3. System Properties -> Properties
4. As shown below, click on 'Mirror' image and select the favcon image that you have uploaded in above step 2.




Thursday, May 25, 2017

How to Auto Close 'Resolved' Incidents after 7 days in Service Now

This blog explains about how to  to auto  Close any 'Resolved' incidents after 'certain (7 days)' period of time.

Step 1 : Create a Schedule Item as shown below


Step 2 : Create a Business Rule as shown below
Step 3 : Write below script in 'Advanced' tab of above business rule

// This script automatically closes incidents that are resolved
// and haven't been updated in the specified number of days.
// This number is a property in System Properties.
// To place a comment in the incident, uncomment the "gr.comments" line.

autoCloseIncidents();

function autoCloseIncidents() {
var ps = gs.getProperty('glide.ui.autocloseincident.time');
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);

if (pn > 0) {
var gr = new GlideRecord('incident');
gr.addQuery('state', 6);
// gr.addQuery('sys_updated_on', '<', queryTime);
gr.addQuery('sys_updated_on', '<', gs.daysAgo(pn));
gr.query();
while(gr.next()) {
gr.state = 7;
//  gr.comments = 'Incident automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.closed_by = gr.resolved_by;
gr.update(); 
}
}
}

Step 4 : Create below System Property (sys_properties.list) for glide.ui.autocloseincident.time 




Schedule Script triggers above business rule every hour and find out any 'Resolved' Incident more than 7 days, it will change the state to 'Closed'










Wednesday, May 17, 2017

How to Enable 'Create New Filter' for anyone

Problem : Allow anyone to 'Create New' filter in Service Now

What is Filter ?

A filter is a set of conditions applied to a table in order to find and work with a subset of the data in that table. Users can apply, modify, create, and save filters. The current filter is indicated by a hierarchical list of conditions—breadcrumbs—at the top of the table. Read More


Implementation

- Make sure you have 'security_admin' role associated .

- Enable 'Elevate Roles'

- Create a new ACL as per below screenshot



- Impersonate with any other role, make sure now you are able to create new filter