Monday, August 27, 2018
Monday, July 30, 2018
Convert the timezone to GMT timezone in ServiceNow
// start and end dates are in the client's timezone
var start = current.u_change_start_date.getGlideObject().getNumericValue();
var end = current.u_change_end_date.getGlideObject().getNumericValue();
var gdt = new GlideDateTime(gs.nowDateTime());
var timeZoneOffSet = gdt.getTZOffset();
// start and end times are in the current timezone
// current date time is in the GMT timezone
// converting start and end times to GMT timezone
start += timeZoneOffSet;
end += timeZoneOffSet;
var start = current.u_change_start_date.getGlideObject().getNumericValue();
var end = current.u_change_end_date.getGlideObject().getNumericValue();
var gdt = new GlideDateTime(gs.nowDateTime());
var timeZoneOffSet = gdt.getTZOffset();
// start and end times are in the current timezone
// current date time is in the GMT timezone
// converting start and end times to GMT timezone
start += timeZoneOffSet;
end += timeZoneOffSet;
Tuesday, July 17, 2018
ServiceNow IT Asset Management - Part2
What is IT Asset Management lifecycle?
The asset management lifecycle covers the period from
initial request for an item through procurement, delivery, stocking,
deployment, monitoring, support, installation (as well as all moves, adds, or
changes in location), upgrades, reuse, termination, disposal, and replacement.
The wide-ranging factors under asset management have been
classified using a simple, three-stage format. This is to help you understand
and manage with ease the best practice methodology in asset management. The
critical aspects of the cycle, from a data accuracy perspective, include
request and procurement at the front end of the cycle and disposal at the back
end. The asset changes that take place fall in between.
Standard process for maintaining the life cycle of an asset
ServiceNow IT Asset Management - Part1
What is IT Asset Management?
IT asset management (ITAM) is a set of business practices
that join financial, contractual, and inventory functions to support life cycle
management and strategic decision making for the IT environment. Managing IT
assets allows you to get maximum value from the use of the assets, right-size
IT inventory, and optimize inventory purchase decisions and strategies.
Hardware Asset Management
Hardware asset management is the process of tracking and
managing the physical components of computers and computer networks, from
acquisition through disposal. The goals of hardware asset management are to
account for all hardware assets on the IT infrastructure to provide
comprehensive inventory visibility. Further, to help with vendor contract and
lease management, and to assist in making budgetary forecasts based on the
stock of assets and business requirement.
Software Asset Management
Software asset management is similar to hardware asset
management, but focuses on software assets, including licenses, versions, and
installed endpoints. ITIL states that the goals of software asset management
are to reduce IT costs and limit business, legal and security risks related to
the ownership and use of computer software, while maximizing IT responsiveness
and end-user productivity
IT Asset Management Methodology
The major goal of ITAM is to establish a centralized asset
repository that accounts for the presence and purchase of all your hardware and
software inventory.
To achieve this, ITAM methodology comprises the following
steps:
·
Asset
discovery, data capture and storage – Discovering all hardware and software
components of IT inventory on the IT infrastructure and capturing their
details, such as the type of asset, make, specification, etc., and storing it
in an asset repository
·
Asset
tracking – Being able to identify and track change in the location of
assets, increase or decrease the number of assets, track assignment status and
user information
·
Asset life cycle management – Being able to capture the asset life cycle data right
from requisitioning, purchase and assignment, to expiry and decommissioning
·
Asset
reporting and alerting – Being able to generate asset inventory reporting,
and receive alerts on asset warranty and lease expiration
Friday, July 13, 2018
Get URL Parameters in a ServiceNow Client Script & Catalog Client Script
Create a onload client script
function onLoad() {
var emp_sys_id = getParmVal('sysparm_emp_sys_id');
}
function getParmVal(name) {
// get the current URL
var url = document.URL.parseQuery();
// decode the URL
if (url[name]) {
return decodeURI(url[name]);
} else {
return;
}
}
function onLoad() {
var emp_sys_id = getParmVal('sysparm_emp_sys_id');
}
function getParmVal(name) {
// get the current URL
var url = document.URL.parseQuery();
// decode the URL
if (url[name]) {
return decodeURI(url[name]);
} else {
return;
}
}
Tuesday, June 26, 2018
Convert LDAP attribute objectGUID from base64 to string in ServiceNow LDAP integration - Transform script
answer = (function transformEntry(source) {
function toHex(d) {
return ("0" + Number(d).toString(16)).slice(-2).toUpperCase();
}
function a2b(a) {
var b, c, d, e = {},
f = 0,
g = 0,
h = "",
i = String.fromCharCode,
j = a.length;
for (b = 0; 64 > b; b++) e["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(b)] = b;
for (c = 0; j > c; c++)
for (b = e[a.charAt(c)], f = (f << 6) + b, g += 6; g >= 8;)((d = 255 & f >>> (g -= 8)) || j - 2 > c) && (h += i(d));
return h;
}
function arrayToGuid(arr) {
return arr.slice(0, 4).reverse().join('').toLowerCase() + '-' + arr.slice(4, 6).reverse().join('').toLowerCase() + '-' + arr.slice(6, 8).reverse().join('').toLowerCase() + '-' + arr.slice(8, 10).join('').toLowerCase() + '-' + arr.slice(10, 16).join('').toLowerCase();
}
function base64StringToGuid(base64string) {
var charArray = GlideStringUtil.base64Decode(base64string).split('').map(function(el) {
return el.charCodeAt(0);
}).map(function(el) {
return toHex(el);
});
return arrayToGuid(charArray);
}
return base64StringToGuid(source.u_objectguid); // return the value to be put into the target field
})(source);
Friday, May 25, 2018
Backend script to logout a user from ServiceNow - SNOW user logout script
var sessions = GlideSessions.get().getLoggedInSessionList();
var it = sessions.iterator();
while(it.hasNext()) {
var session = it.next();
if (session.getUser() == gs.getUserName()) {
var httpSession = session.getHS();
httpSession.setAttribute("locked_out", "true");
}
}
var it = sessions.iterator();
while(it.hasNext()) {
var session = it.next();
if (session.getUser() == gs.getUserName()) {
var httpSession = session.getHS();
httpSession.setAttribute("locked_out", "true");
}
}
Subscribe to:
Posts (Atom)

