Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..
655 views

Create a schedulle task update a feild ni cm3rm2 to zero

Jump to solution

I need to reset a feild call: mandaysht to zero  in 1st each month

I found out that HPSM 9.30 have schedule task

But it seem have no thing to do with table update, only create IM, CM,..etc

Can you guide me some steps. i got images in attachment

1.Jpg2.Jpg

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Create a schedulle task update a feild ni cm3rm2 to zero

Jump to solution

For writign the javascript please check the document : http://docs.software.hpe.com/SM/9.51/Codeless/Content/programming/javascript/concepts/javascript_and_service_manager_reference.htm

For your use case, you can try below code:

var filevar = new SCFile("cm3r");

var sql = "status<>" + '"' + "closed"+ '"';
var success = filevar.doSelect(sql);

while ( success== RC_SUCCESS)
{
    filevar.yourFieldNameInDbdict=0;
    success=filevar.getNext();
}

You can try the script in scriptLibary first.

Ling-Yan

 

View solution in original post

3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Create a schedulle task update a feild ni cm3rm2 to zero

Jump to solution

@TuanHoang,

I would suggest you to add your own schedule for this purpose.

You need to add a schedule record like below, and set the Expiration as the time you want to run.2017-04-07_14-46-15.jpg

And put your business logic in the Javascript&colon;

2017-04-07_14-46-26.jpg

That's it. Then the "problem" scheudler will call the code in this schedule, and set the Expiration time as this.Expiration + 1 month.

To test it out, you can mannully set the Expiration to a time in the past, and the schedule will be run in a minute.

Let me know if it helps,

Ling-Yan

0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: Create a schedulle task update a feild ni cm3rm2 to zero

Jump to solution

Thank to your reply

What script should i write in javascript feild?

I want to update feild named "MANDAYSHT" all opening changes in cm3rm2 tables to zero each 1st each month

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Create a schedulle task update a feild ni cm3rm2 to zero

Jump to solution

For writign the javascript please check the document : http://docs.software.hpe.com/SM/9.51/Codeless/Content/programming/javascript/concepts/javascript_and_service_manager_reference.htm

For your use case, you can try below code:

var filevar = new SCFile("cm3r");

var sql = "status<>" + '"' + "closed"+ '"';
var success = filevar.doSelect(sql);

while ( success== RC_SUCCESS)
{
    filevar.yourFieldNameInDbdict=0;
    success=filevar.getNext();
}

You can try the script in scriptLibary first.

Ling-Yan

 

View solution in original post

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.