Wednesday, April 4, 2018

LDAP integration vs. SSO ServiceNow what is the difference?


LDAP integration means that your Service-Now instance will pick up newly created Users from the Active Directory, either through Listener ports or through Scheduled Uploads, and when you authenticate yourself while Logging onto Service-Now, this authentication is happening from the AD.


SSO implemented means that you do not have to re-authenticate yourself when trying to access ServiceNow, once you log into an Environment while accessing different Applications for whom SSO is enabled

Wednesday, March 28, 2018

Make all form fields read only - ServiceNow Client Script

var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
    g_form.setReadOnly(fields[x], true);
}

Thursday, March 22, 2018

ServiceNow group approval through workflow script


var approval_gr = new GlideRecord('sysapproval_group');

approval_gr.initialize();
approval_gr.approval = 'requested';
approval_gr.parent = current.sys_id;
approval_gr.assignment_group = current.assignment_group;
approval_gr.short_description = 'Change Management Approval';
approval_gr.wait_for = 'any';
approval_gr.insert();

Sunday, March 11, 2018

SSO - ServiceNow integration with Microsoft Azure AD

https://docs.microsoft.com/en-us/azure/active-directory/active-directory-saas-servicenow-tutorial

Wednesday, February 14, 2018

Create a user approval through script in ServiceNow workflow


var approval_gr = new GlideRecord('sysapproval_approver');
approval_gr.initialize();
approval_gr.state = 'requested';
approval_gr.approver = gs.getUserID();
approval_gr.sysapproval = current.sys_id;
approval_gr.insert();

The approver and sysapproval columns should be replaced according to your required values.

Monday, February 12, 2018

Make attachment mandatory for catalog item submission

We can use the following catalog client script onSubmit


var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "sc_cart_item");
gr.addQuery("table_sys_id", g_form.getUniqueValue());
gr.query();

if (!gr.next()) {
alert("Attachment mandatory.");
return false;
}

Friday, February 9, 2018

Cancel a workflow using a script when any one of RITM approvals are rejected | ServiceNow

Use the following script in the run script activity of the current workflow



answer = true;
var sag = new GlideRecord('sysapproval_group');
sag.addQuery('parent', current.sys_id);
sag.query();
while(sag.next()) {
if(sag.approval == 'rejected') {
current.state = '4';

var w = new Workflow();
var gr = new GlideRecord('wf_context');

if (gr.get(current.context))
w.cancelContext(gr);
}
}