can we use glideDateTime in client script of UI page?

srinivasr
Mega Contributor

I have an scenario where i need to query incident and extract sys_created_on value and put into a string variable.

Read the DateTime API's still not able to achieve this for UI page (client script).

Tried trouble shooting with debug and I get the alert "Before Declare" and not the second alert. Is there any issue with the declaration?

Any helps on this is much appreciated.

Client Script of UI page

function validateComments() {

  var gdt1 = '';

    var gr = new GlideRecord('incident');

    gr.addQuery('active','true');

    gr.query();

    while(gr.next()){

                        alert('Before declare');

                      var glideDateTime = new GlideDateTime(gr.sys_created_on);

                      alert('after decalring');

                      gdt1 = glideDateTime.getValue();

                      gs.log('str gdt1' + gdt1);

  }

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

No, GlideDateTime will not work client side.   You will have to resort to GlideAjax and Script Includes.


View solution in original post

2 REPLIES 2

Mike Allen
Mega Sage

No, GlideDateTime will not work client side.   You will have to resort to GlideAjax and Script Includes.


Thanks Mike for letting me know that. You saved a lot of time!!!