Highlighted
Super Contributor.
Super Contributor.
391 views

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

0 Likes
8 Replies
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: How to write custom field greater than 3 days

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

Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to write custom field greater than 3 days

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

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to write custom field greater than 3 days

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)

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to write custom field greater than 3 days

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");
}

 

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to write custom field greater than 3 days

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

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to write custom field greater than 3 days

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

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to write custom field greater than 3 days

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

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: How to write custom field greater than 3 days

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.