Highlighted
Absent Member.
Absent Member.
386 views

Set Expected Resolution date to open date + 7 days using Script not working

Jump to solution

Hi Experts,

I have a requirement to set Expected Resolution Date to open.time +7 days. To meet the requirement I wrote the script as follows

function CalculateDate()
{

       var ticket = new SCFile("rootcause");
       var rc = ticket.doSelect("current.phase=\"Investigation\"");
       var d = 0;
if (rc == RC_SUCCESS)
{
          d= open_time + 7;
         ticket.expected_resolution_time=d;
         ticket.doUpdate();
}
} CalculateDate();

While executing this script I am getting error as "Reference Line Error: open.time not defined".

If i try to use some custom Date/string field still I am getting same Error.

Kindly suggest..

Regards,

-DK

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Set Expected Resolution date to open date + 7 days using Script not working

Jump to solution

 

While you load a rootcause record in your first lines of the script, you're not referencing that record when you try to set the value of d to 'open_time'.  I _think_ you want:

d = rc.open_time

However, adding a number (7) to a date/time type won't give you what you're looking for either.

I suggest you read the help documentation on adding dates in javascript

View solution in original post

2 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Set Expected Resolution date to open date + 7 days using Script not working

Jump to solution

 

While you load a rootcause record in your first lines of the script, you're not referencing that record when you try to set the value of d to 'open_time'.  I _think_ you want:

d = rc.open_time

However, adding a number (7) to a date/time type won't give you what you're looking for either.

I suggest you read the help documentation on adding dates in javascript

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: Set Expected Resolution date to open date + 7 days using Script not working

Jump to solution

Thanku @Jacob Heubner...

 

The Issue is resolved ,also manged to add the days to currect date using online JavaScript.

 

Regards,

DK

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.