GlideDate() is working in client Script, however the requirements should be in GlideDateTime (). Is there anyone who can assist me with this?

Ashoka Panchal
Tera Contributor

var recPriority = g_form.getValue('u_rec_rating');
var cdt = new Date();  // When I use GlideDateTime() it's showing error.
var addtime;
var addtype = 'day';
if (recPriority == '2') {

addtime = 7; //The amount of time to add
}
if (recPriority == '3' || recPriority == '4') {

addtime = 90; //The amount of time to add

}

var ajax = new GlideAjax('global.ClientDateTimeUtils');
ajax.addParam('sysparm_name', 'addDateAmount');
ajax.addParam('sysparm_fdt', cdt);
ajax.addParam('sysparm_addtime', addtime);
ajax.addParam('sysparm_addtype', addtype);
ajax.getXML(doSomething); //Need callback function

function doSomething(response) {
//Sets field
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('due_date', answer);

Current Result:  find_real_file.png

Expected : DateTime

15 REPLIES 15