I have a requirement to purge completed jobs. I was able to purge the completed jobs successfully by executing purgecompletedjobs command successfully on command line interface. Could you please let me know as to what is the best way (also steps) to schedule purgecompletedjobs command to purge completed jobs at a regular interval.
The best way is to schedule the PURGECOMPLETEDJOBS cli command daily to purge all completed jobs that are older than a specified number of days.
Please refer to the sample applications in Desktop Client 11.3.x or DE R12 with examples;
I created another house keeping application by copying the house keeping utility application and executed it. Command deletestatusmessages threshold('%APPL.date') deleted the messages older than time period May 1st 2016 (Date and Time 2016-5-1 12:31:41). Is there a way to change the threshold to 7 days old date so that deletestatusmessages command deletes all the messages older than 7 days.
//Configure how many days older statuesmessages to delete
var no_of_days = 7
var old_date = new Date();
old_date.setDate(old_date.getDate() - no_of_days);
APPL.date = (old_date.getYear()+1900)+'-'+old_date.getMonth()+'-' +old_date.getDate()+' '+old_date.getHours()+':'+old_date.getMinutes()+':'+old_date.getSeconds();
Thanks for your response. As per CA support, there is a bug in the java script. Support gave me below java script to replace with the existing one, and it worked as expected.
var month = eval(old_date.getMonth() + 1)
APPL.date = (old_date.getYear()+1900)+'-'+month+'-' +old_date.getDate()+' '+old_date.getHours()+':'+old_date.getMinutes()+':'+old_date.getSeconds()