Use Case:
Let us assume a scenario where the technicians resolves a request and places the request on Resolved status. As per requirement to close resolved requests after an hour (Schedule can be customized based on requirement Days/ hours ) . This is achieved by running a query report under Servicedeskplus-msp which will return the ids of Resolved requests. These are provided as input to a python script in json format.The script then uses request API to update those request's status as 'closed'.
Execution steps:
1. Go to Reports--> New Query Report and run the below query and save this report.
SELECT wo.WORKORDERID AS "Request ID",ad.ORG_NAME AS "Account" FROM WorkOrder wo LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID INNER JOIN Accountsitemapping asm ON wo.siteid=asm.siteid INNER JOIN AccountDefinition ad ON asm.accountid=ad.org_id LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID LEFT JOIN WorkOrderHistory woh ON wo.WORKORDERID = woh.WORKORDERID LEFT JOIN WorkOrderHistoryDiff wohd ON woh.HISTORYID = wohd.HISTORYID LEFT JOIN StatusDefinition std1 ON cast(cast(wohd.prev_value AS varchar) AS int) =std1.STATUSID LEFT JOIN StatusDefinition std2 ON cast(cast(wohd.current_value AS varchar) AS int) = std2.STATUSID WHERE ((( OPERATIONTIME >= <from_thisyear> ) AND ( OPERATIONTIME <= <to_thisyear> ))) AND wo.ISPARENT='1' and wohd.COLUMNNAME IN ('STATUSID') and std.STATUSNAME = 'Resolved' group by wo.WORKORDERID,ad.ORG_NAME
This will give you the ID of requests under Resolved status. Save the Report as Resolved Request
2. Downloaded and place the script file in the ManageEngine/ ServiceDeskPlus-MSP/ integration/custom_scripts folder.
3. Update the application URL and the Technician Key in the script with the help of the comments provided within.
4. Configure the schedule under Admin--> Custom Schedule
A short guide on setting up python is available here.