Technique 1 for the async await
Saturday, 13 November 2021
Async Await in Javascript(JS)
Friday, 12 November 2021
Promises in Javascript(JS)
const pobj = new Promise((resolve, reject)=> {
Monday, 8 November 2021
Basic codes in ServiceNow
var count = new GlideAggregate('incident');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if(count.next())
incidents = count.getAggregate('COUNT'); // we can directly print the count
gs.addInfoMessage(incidents);
gs.addInfoMessage(now_GR.getRowCount());
var count = new GlideAggregate('incident');
count.addQuery('active', 'true');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if(count.next())
incidents = count.getAggregate('COUNT');
gs.a
----------------------------------------------------
Glide Aggregiate:-
var count = new GlideAggregate('incident');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if(count.next())
incidents = count.getAggregate('COUNT'); // we can directly print the count
gs.addInfoMessage(incidents);
gs.addInfoMessage(now_GR.getRowCount());
var count = new GlideAggregate('incident');
count.addQuery('active', 'true');
count.addAggregate('COUNT');
count.query();
var incidents = 0;
if(count.next())
incidents = count.getAggre
var count = new GlideAggregate('incident');
count.addQuery('active','true');
count.addAggregate('COUNT','category');
count.query();
while(count.next()){
var category = count.category;
var categoryCount = count.getAggregate('COUNT','category');
gs.log("there are currently "+ categoryCount +" incidents with a category of "+ category);}
same for glide record try....
var incidentGA = new GlideAggregate('incident');
incidentGA.addAggregate('COUNT');
incidentGA.addAggregate('SUM');
incidentGA
Create email using BR in ServiceNow
var obj = new GlideRecord('u_practice_on_businessrule');
var f_name = current.u_first_name;
var l_name = current.u_last_name;
current.u_email_2.setValue(f_name+"."+l_name+"@gmail.com");
gs.addInfoMessage("New email Created");
Total record count using GlideRecord in ServiceNow
It can also be executed using glideAggregate
var inc = new GlideRecord('incident');
//inc.addActiveQuery();
inc.query();
var cat=["inquiry" , "software" , "hardware" , "network" , "database"];
var c1=0, c2=0, c3=0, c4=0, c5=0 , c6=0;
while(inc.next())
{
if(inc.category == cat[0])
{
c1++;
//gs.addInfoMessage(inc.number+" = "+" , "+c1+" "+cat[0]);
}
else if(inc.category == cat[1])
{
c2++;
//gs.addInfoMessage(inc.number+" = "+" , "+c2+" "+cat[1]);
}
else if(inc.category == cat[2])
{
c3++;
//gs.addInfoMessage(inc.number+" = "+" , "+c3+" "+cat[2]);
}
else if(inc.category == cat[3])
{
c4++;
//gs.addInfoMessage(inc.number+" = "+" , "+c4+" "+cat[3]);
}
else if(inc.category == cat[4])
{
c5++;
//gs.addInfoMessage(inc.number+" = "+" , "+c5+" "+cat[4]);
}
else if(inc.category == "")
{
c6++;
gs.addInfoMessage(inc.number+" = "+" , "+c6+" BLANK CATEGORY");
}
}
gs.addInfoMessage("Category = "+cat[0]+" , total number of record = "+c1);
gs.addInfoMessage("Category = "+cat[1]+" , total number of record = "+c2);
gs.addInfoMessage("Category = "+cat[2]+" , total number of record = "+c3);
gs.addInfoMessage("Category = "+cat[3]+" , total number of record = "+c4);
gs.addInfoMessage("Category = "+cat[4]+" , total number of record = "+c5);
gs.addInfoMessage("Category = BLANK CATEGORY , total number of record = "+c6);
gs.addInfoMessage(inc.getRowCount());
Sunday, 7 November 2021
Callback hell in Javascript
const RollNo = () => {