In the below table(discovery_range_item_ip) item_parent is a reference field;
var range_table=new GlideRecord('discovery_range_item_ip');
range_table.addQuery('item_parent.name', "JDC_AIX1_RANGE");
range_table.query();
gs.log('Row Count'+ range_table.getRowCount());
Wednesday, March 28, 2018
Code base #2
-- item table
AIX1 Y
AIX2 Y
AIX3 N
----
Excel -->values-->insert into AIX3-->{code to check total count --Full set isFull to Yes}---> create new table AIX4 -->isFull --"No"---
Start inserting --->count reaches 250----> isFull='Yes'----
AIX1 Y
AIX2 Y
AIX3 N
----
Excel -->values-->insert into AIX3-->{code to check total count --Full set isFull to Yes}---> create new table AIX4 -->isFull --"No"---
Start inserting --->count reaches 250----> isFull='Yes'----
Saturday, March 24, 2018
Javascript to split ; ServiceNow Script
var str = "172.168.1.1";
var res = str.split(".", 2);
gs.log(res);
https://www.w3schools.com/jsref/jsref_split.asp
var res = str.split(".", 2);
gs.log(res);
https://www.w3schools.com/jsref/jsref_split.asp
Insert Row to a Glide Record table ServiceNow
//Create a new Incident record and populate the fields with the values below
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = 'Network problem';
gr.category = 'software';
gr.caller_id.setDisplayValue('Joe Employee');
gr.insert();
Reference: https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = 'Network problem';
gr.category = 'software';
gr.caller_id.setDisplayValue('Joe Employee');
gr.insert();
Reference: https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
Friday, March 23, 2018
Custom VIP icon ServiceNow
Create an image in image module
get the name of the image (Example: VIP.gif)
Go to Caller Field->Configure styles->style->
background-image: url('VIP.png');
background-repeat: no-repeat;
background-position: center center;
padding-right: 30px;
Go to Client Scripts-> Highlight VIP Caller->change the URL to updated one
before :
callerLabel.setStyle({backgroundImage: "url('images/icons/vip.gif')", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
after:
callerLabel.setStyle({backgroundImage: "url('VIP.png')", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
get the name of the image (Example: VIP.gif)
Go to Caller Field->Configure styles->style->
background-image: url('VIP.png');
background-repeat: no-repeat;
background-position: center center;
padding-right: 30px;
Go to Client Scripts-> Highlight VIP Caller->change the URL to updated one
before :
callerLabel.setStyle({backgroundImage: "url('images/icons/vip.gif')", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
after:
callerLabel.setStyle({backgroundImage: "url('VIP.png')", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
Image Picker ServiceNow
Thursday, March 22, 2018
Get union of 2 arrays removing intersection values (Javascript)
var array1 = ['12','1','10','19','100','test'];
var array2 = ['12','10','19','test1'];
var array3 = array1.filter(function(obj) { return array2.indexOf(obj) == -1; });
var array4 = array2.filter(function(obj) { return array1.indexOf(obj) == -1; });
gs.print('----> array1 Values----->'+ array1);
gs.print('----> array2 Values----->'+ array2);
gs.print('----> array3 Values----->'+ array3);
gs.print('----> Concat Values----->'+ array3.concat(array4));
Reference:
https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
Subscribe to:
Posts (Atom)
Discovery troubleshooting | Error messages
Discovery troubleshooting | Error messages - Support and Troubleshooting (servicenow.com) Description Learn how to resolve common Discover...
-
Steps to Debug Inbound REST API Calls in Service Now: 1. Make sure the property “ glide.rest.debug ” is set to true under sys_prop...
-
Error Log - [ecc_agent_status] table record missing for MIDSERVER "Midserver name" : no thrown error in Logs. Cause: ( Clon...
-
Get the instance name from BusinessRule in ServiceNow to avoid Hardcoding. Create a Global variable and assign the instance to it and he...