This post describes the use of a python script to close Preventive maintenance Requests using Custom Schedules.
What is 'Custom Schedules'?
The Custom Schedules feature enables you to access any data in ServiceDesk Plus to perform customized actions periodically. Each custom schedule can associate Query Reports as arguments to a script file. You can even synchronize ServiceDesk Plus data with other third-party applications to perform various actions, such as sending mailer campaigns to requesters at regular intervals or updating various attributes of requests periodically. You will find more information about this feature in the document available here.
Use case of customer:
User scheduled a Preventative maintenance task request at 2:PM and 10:PM ,once this 2 PM Preventive Maintenance Tasks request reaches 11:00 PM it needs to be closed and notification needs to be sent to the respective team with the Description and subject. Same 10:00 PM Preventative maintenance task request task to be closed at 7:00 AM and notification needs to send once this is closed.
Execution steps:
1.Download the contents and paste it under \ManageEngine\ServiceDesk\integrations\Custom_scripts.
2. Go to Reports tab --> New query report --> copy the query to the query editor and run the report. Save the report in the folder.
The query is available in the attachment (query.txt).
Modify the subject in the query
wo.TITLE = 'test subject' > This should be PM TASK subject
3. Configure 2 custom schedules at 11 pm and another one at 7 am.
Attached screenshot for reference.
4. In the configuration.json, configure the URL and technician key.
If you already have a configuration.json file in the folder do not replace it.
A short guide on setting up python is available here.