- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 07:59 AM
Hi all,
I'm trying to set up a scheduled job that runs off a variable on the sc_item_option table called 'Termination Date'.
The problem I have is that the value in the sc_item_option table has converted the value to a string, therefore when i try to put a query on date, it isn't recognizing the value as a date.
Is it possible to store this value as a date so we can query on it..?
Thanks guys
Rich
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 01:56 AM
Hi,
How about querrying sc_req_item itself, sample code would be below
var gr = new GlideRecord("sc_req_item");
gr.addActiveQuery();
// Use can add more filter condition here to filter the number of records
gr.query();
while (gr.next()) {
var vars = gr.variables;
for ( var v in gr.varibles ) {
if ( v == "giveTheNameOfTheVariableHere") {
var dateTime = new GlideDateTime(gr.variables[v].toString());
// Write your logic here based on your calculations, now you have DateTime Object access via variable dateTime
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2019 04:31 AM
Glad that it worked for you and thank you for reporting back and marking answer as correct.
Have a wonderful day ahead !
