sc_item_option variable

Richard Thomas2
Tera Contributor

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'. 

find_real_file.png

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.

find_real_file.png

Is it possible to store this value as a date so we can query on it..?

Thanks guys

 

Rich

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

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
            }
      }
}

View solution in original post

10 REPLIES 10

Glad that it worked for you and thank you for reporting back and marking answer as correct.

Have a wonderful day ahead !