How to write custom field greater than 3 days

Hello Everyone,

 

I would like to create a new script to query when field resolved time greater than 3 days.

I've tried to wrote a script, here are the details:

var finc = new SCFile("incidents");
var q = "alz.resolved.time>tod()-'3 00:00:00'";
var rc = finc.doSelect(q);

while(rc==RC_SUCCESS){
if(rc==RC_SUCCESS){
print(finc.incident_id);
}else{
print("no interaction ticket found");
}
rc=finc.getNext();
}

But the result showing null values or no interaction ticket found from the query.  I've tried also (date(tod))>'3 00:00:00' but still doesn't work.

Can anyone suggest the best solution? 

 

Best Regards,

Okik

  • Hello!

    Instead of writing tod(), try with system.functions.tod().

    However, I'm still not sure whether the comparison ">" will work correctly, since tod() returns date and time in a specific format (for example, 05/29/17 10:00:00).

  • "field resolved time greater than 3 days" - If you mean older (over) 3 days.

    var q = "alz.resolved.time<system.functions.tod()-'3 00:00:00'";

    I would have made the expression more clear\understandable

    var q = "system.functions.tod()-alz.resolved.time>'3 00:00:00'";

     

    And i think you never get message - "no interaction ticket found" even if interactions is not found.

  • I've tried your syntax but I got this error

    Invalid syntax for query.  Failed parsing (display,process.option)

    alz.resolved.time<system.functions.tod()-'3 00:00:00' (display,process.option)

  • what kind of interaction you wanna get in this list ?

     And when it must be displayed (view, report,....)?

    =====================================

     

    var finc = new SCFile("incidents");
    
    // 259200000 - 3 days in miliseconds var q = "alz.resolved.time > system.functions.tod()-'259200000'"; var rc = finc.doSelect(q); if (rc == RC_SUCCESS)
    {
    do
    {
    print(finc.incident_id);
    } while(finc.getNext() == RC_SUCCESS);
    else {
    print("no interaction ticket found");
    }

     

     

  • what kind of interaction you wanna get in this list ?

     And when it must be displayed (view, report,....)?

    =====================================

     

    var finc = new SCFile("incidents");
    
    // 259200000 - 3 days in miliseconds var q = "alz.resolved.time > system.functions.tod()-'259200000'"; var rc = finc.doSelect(q); if (rc == RC_SUCCESS)
    {
    do
    {
    print(finc.incident_id);
    } while(finc.getNext() == RC_SUCCESS);
    else {
    print("no interaction ticket found");
    }

     

     

  • what kind of interaction you wanna get in this list ?

     And when it must be displayed (view, report,....)?

    =====================================

     

    var finc = new SCFile("incidents");
    
    // 259200000 - 3 days in miliseconds var q = "alz.resolved.time > system.functions.tod()-'259200000'"; var rc = finc.doSelect(q); if (rc == RC_SUCCESS)
    {
    do
    {
    print(finc.incident_id);
    } while(finc.getNext() == RC_SUCCESS);
    else {
    print("no interaction ticket found");
    }

     

     

  • Hi Alarm,

     

    Thanks for the reply. I've tried the query but i am still getting same error message. Here are the details:

    forum.PNG

     

    Actually, I would like to set a new field to true when field alz.resolved.time greater than 24 hours from script library, so I can run the script by schedule.

    for example:

    if alz.resolved.time > 24 hours

    alz.notif.day.one=true;

    else

    alz.notif.day.one=false;

     

    Appreciate for anything help.

     

    Best Regards,

    Okik

  • alz.resolved.time - this is planned time, when interaction must be resolved or this is time when status of interacton changed to resolved ?

     

    ****

     

    As i understand, you need:

    1) schedule - which start dayly

    2) in schedule select all opened interactions where alz.resolved.time older current time more than 24h

     ? send notification about same interaction every day while its open

    or

    ? send notification about each interaction once

  • Hi Alarm,

     

    Thanks for the reply. Field alz.resolve.time is time when status of interaction changed to resolved.

    forum.PNG

    I'm listening.

     

    Best Regards,

    Okik

  • As i understand, you need:

    1) schedule - which start dayly

    2) in schedule select all opened interactions where alz.resolved.time older current time more than 24h

     ? send notification about same interaction every day while its open

    or

    ? send notification about each interaction once

    1. Yes, correct I need schedule wich start daily or every hours.

    2. In schedule select all resolved interactions where alz.resolved.time > 24 hours

    3. Once I found interaction tickets where alz.resolved.time > 24 hours, send reminder notification to users.

     

    Do you have any approach to meet the requirement above?

    Im listening

     

    THANKS,

    Okik