Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get current date time in encoded query in UI action

shilpa344
Giga Expert

Hi All,

I am created one UI action which query another custom table to fetch some data. I have created some query to filter the data.

Now i wanted to filter data on the basis of date but date field in custom table is string instead of Date/Time.

Any ideas how to filter records on the basis of date.

u_effort=false^u_process=85c1619b6fa8e60061e201ccbb3ee445^u_date>=2016-07-22

This u_date is the date field in the custom table which I am querying and i wanted display latest records where date should be greater then equal to current date.

5 REPLIES 5

gupta_vipul013
Mega Expert

Hi Shilpa,



We can create a classless script include (Thanks to Chuck for his youtube video on Script Include) to return the Glide Date Time. You can pass the u_date (date field of custom table). It will return the date in Glide Date/Time format. Below is the screenshot:


Snow.png










And Use this Script Include in condition field of the UI action like this:


(gs.dateDiff(gs.nowDateTime().getDisplayValue(), global.string_to_date("2017-12-11").getDisplayValue(), true)>0)



Kindly let me know, if it is helpful.