Delete Tasks

Delete Tasks

Requirement:  Delete all tasks.

UseCase:  Deleting tasks with task id less than a particular count.

Please follow the below steps. 
  1. Goto Reports > New Query Report > execute the query and save it with a name.
    1. select taskid, helpdeskid "portaild" from taskdetails where taskid < 300
    2. All tasks with task id less than 300 will be deleted.  This can be modified as per your requirement.
    3. Execute the query and save the report with a name. [Report name: deletetask]
  2. Goto Admin > Custom Schedule Function > Global Function > New > Paste the global function contents and save it with a name.
    1. Update the URL and integration key in the script. 
    2. You can get the integration key under Admin > Integrations > Integration Key > New
    3. Please use an integration key with admin privilege, as there wont be any role related permission issues. 

    4. Update the integration key in the global function.

  3. Goto Admin > Custom Schedule Functions > New > Paste the content from Delete_task.txt and save it with a name

  4. Configure a custom schedule to invoke the created custom function with the query report as parameter. 
    1. Note:  We can configure this on repeat mode if the task count is huge.




                  New to ADSelfService Plus?

                    • Related Articles

                    • Project,Milestone and Tasks.

                      DB Compatability: PgSQL and MSSQL SELECT projectdet .PROJECTID "Project Id", projectdet.TITLE "Project Title", projectstatus.STATUSNAME "Project Status", projectowner.FIRST_NAME "Project Owner", longtodate(projectdet.SCHEDULEDSTARTTIME) "Project ...
                    • Query to show PM task details with Next schedule and last ran time (MSSQL & PGSQL)

                      Tested in Build PGSQL (14300) or MSSQL (14306) Next schedule time : SELECT swo.WORKORDERID "PM Task ID", adef.org_name "Account", sdo.name "Site", ti.SCHEDULE_TIME "Next Schedule Time", aau.FIRST_NAME "Requester", dpt.DEPTNAME "Department", ...
                    • Script to Auto close Preventive Maintenance Requests

                      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 ...
                    • Query to show tasks created per template along with status (MSSQL & PGSQL)

                      Tested in builds from PGSQL (14300) or MSSQL (14306) Since Task template is not stored in Task details, we cannot show count based on task templates. However, we have tried to form a query with task subject considering that, when task templates are ...
                    • Delete requests

                      If you would like to delete the older requests, you could use the below query. Connect to the Database For MSSQL: delete from workorder where dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (CREATEDTIME/1000),'1970-01-01 00:00:00') <= ...