Need to create a script include that returns the current date and time

rog
Giga Contributor

Hi all,

 

I have a requirement where in I need to create a script include which returns the current date and time to the client script. I have created a field 'date' on the incident form, it should update the field with the current date when the incident is created.

 

Thanks for the help in advance.

1 ACCEPTED SOLUTION

Upender Kumar
Mega Sage

Hi,

And for Script include client side callable 

 

find_real_file.png

 

Thanks

 

View solution in original post

4 REPLIES 4

Upender Kumar
Mega Sage

Hi,

For this you can create a Before insert business rule and set your filed to 

current.yourfield=gs.now(); //set only date without time and gs.nowDateTime() full datetime

 

 

 

Thanks

Upender Kumar
Mega Sage

you can also

 

Thanks

Upender Kumar
Mega Sage

Hi,

And for Script include client side callable 

 

find_real_file.png

 

Thanks

 

Gajanan Birada1
Giga Expert

Hi,

 

Script Include-which will return current date time using GlideDateTime API. use method object name.getLocalTime()

write client script to parse that time.

write call back function 

function callback(response)
{


var answer1=response.responseXML.documentElement.getAttribute('answer');

var a=answer1.split(" ");

var time=a[1];
var time1=time.split(":");
var hour=time1[0];
var minute=time1[1];
var second=time1[2];
var time=hour+"/"+minute+"/"+second;  //set this date to particular time field;

Thank You