Trigger a set of tasks

Trigger a set of tasks

Requirement:
Auto Trigger a set of task associated to a request depending on the date configured in the request additional field.

Steps to follow:
  1. Goto Reports > New Query Report > execute the query and save it with a name.
    1. PGSQL:
    2. SELECT wo.helpdeskid "portalid",wo.WORKORDERID AS "workorderid", taskdet.TASKID AS "taskid"  FROM WorkOrder wo LEFT JOIN Workorder_fields wof ON wo.WORKORDERID=wof.WORKORDERID LEFT JOIN WorkorderToTaskdetails wotk ON wo.WORKORDERID=wotk.WORKORDERID LEFT JOIN TaskDetails taskdet ON wotk.TASKID=taskdet.TASKID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID WHERE (taskdet.MODULE='request' and wo.ISPARENT='1') and (extract(epoch from(now()::TIMESTAMP -  to_timestamp(wof.UDF_DATE1/1000)::TIMESTAMP))/3600/24 >= 0 and extract(epoch from(now()::TIMESTAMP -  to_timestamp(wof.UDF_DATE1/1000)::TIMESTAMP))/3600/24 <1 )
    3. MSSQL:
    4. SELECT wo.helpdeskid "portalid",wo.WORKORDERID AS "workorderid", taskdet.TASKID AS "taskid"  FROM WorkOrder wo LEFT JOIN Workorder_fields wof ON wo.WORKORDERID=wof.WORKORDERID LEFT JOIN WorkorderToTaskdetails wotk ON wo.WORKORDERID=wotk.WORKORDERID LEFT JOIN TaskDetails taskdet ON wotk.TASKID=taskdet.TASKID LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID WHERE (taskdet.MODULE='request' and wo.ISPARENT='1') and (DATEDIFF(day, dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +(wof.UDF_DATE1/1000),'1970-01-01 00:00:00'),GETDATE()) >= 0 and DATEDIFF(day, dateadd(s,datediff(s,GETUTCDATE() ,getdate()) +(wof.UDF_DATE1/1000),'1970-01-01 00:00:00'),GETDATE()) <1 )
    5. Execute the query and save the report with a name. [Report name: trigger_task]
  2. Goto Admin > Custom Schedule Function > Global function > New > Paste the content from the attachment Global function_4.txt  and save it with a name.
  3. Update the URL and integration key in the script. 
    1. You can get the integration key under Admin > Integrations > Integration Key > New
    2. Please use an integration key with admin privilege, as there wont be any role related permission issues. 

    3. Update the integration key in the global function.

  4. Goto Admin > Custom Schedule Functions > New > Paste the content from trigger_task.txt and save it with a name
    1. Refer to the attached script. (trigger_task.txt.)

    2. Update the global function count in the script as per your instance.
  5. 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 ADManager Plus?

                    New to ADSelfService Plus?