pavan9885
Tera Guru

This Book let contains total service now scripting

Comments
Srikanth13
Tera Contributor

@pavan9885 Thank you for the attachment.

Can you provide the link for the origin of the guides? so. it'll help to get the remaining guides as like above.

Thanks in advance.

 

Regards,

Srikanth

raju banoth
Tera Explorer
  1. Target Date
    1. Set to Mandatory
    2. Should not be allowed to select
  1.       past date prior to current date
  2.       current date, If trying to submit after 4 PM of the current day, should select the next day.

Please help me and ,I have one script

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading ||oldValue == 'newValue') {
return;
}

var date = new Date().toISOString().split("T")[0];
var date1 = new Date();
// alert("Current Date :" + date);
var target = g_form.getValue("t2r_target_date");
//alert("field Date : " + target);
// var nowDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
var today = date1.getDate();

// var nowDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + today;
var nextDate = parseInt(today) + 1;
if (nextDate < 10) {
nextDate = "0" + nextDate;
}
// alert(nextDate);
var nowTime = date1.getHours();
// alert(nowTime);
//alert(nowDate);
if (target <+ date) {
// alert("Valid Date");
if (nowTime > 16) {
// alert("Setting Tmrw Date");
g_form.setValue("t2r_target_date", date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + nextDate);
}
//else {
// // alert("Today Date");
// g_form.setValue("t2r_target_date", nowDate);
// }

} else
g_form.setValue("t2r_target_date", date);


}

Hemant19
Kilo Guru

nice

Community Alums
Not applicable

Hello everyone

my colleague and I, we are trying to understand why we are not getting any expected result after creating a UI Action button with this condition "current.canWrite() && !current.begin.nil() && current.end.nil() && current.u_state !== 3 && current....

 

Please assist 

Anish Reghu
Kilo Sage
Kilo Sage

Guess this is the PDF copy of the topic - Scripting in ServiceNow  on our Product documentation.

 

Regards,

Anish

Community Alums
Not applicable

Thanks 

Version history
Last update:
‎02-12-2019 09:29 PM
Updated by: