The CreatorCon Call for Content is officially open! Get started here.

How to define current date and Time in Transform Script

Saib1
Tera Guru

Hi,

How to mention the current data and time for the below one .

Below is not working

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Shohaib 

Don't use gs.now()

It won't work in scoped app and also it just gives you the date and not date/time

update as this

target.last_discovered = new GlideDateTime();

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

4 REPLIES 4

ersureshbe
Giga Sage
Giga Sage

Hi,

Can you try below function.

gs.nowDateTime()
 
You can use gs.now() but it will show only date not time.
 
Regards,
Suresh.
Regards,
Suresh.

Sukraj Raikhraj
Kilo Sage

https://docs.servicenow.com/bundle/sandiego-platform-administration/page/script/server-scripting/concept/c_MappingOptions.html

The date can be formatted in code or on the transform map UI

ersureshbe
Giga Sage
Giga Sage

Hi,

Is your issue fixed and if answered your question, can you mark it as correct answer and help to close the thread.

Regards,

Suresh.

Regards,
Suresh.

Ankur Bawiskar
Tera Patron
Tera Patron

@Shohaib 

Don't use gs.now()

It won't work in scoped app and also it just gives you the date and not date/time

update as this

target.last_discovered = new GlideDateTime();

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader