How to auto-create worklog based on values specified in the request

How to auto-create worklog based on values specified in the request


This post will to help you create a worklog automatically when a request is created. This script can be configured under Request custom triggers and you will find more information about this here. This is achieved using an API call to create a worklog.

Use Case:
Consider the following scenario: 
A user calls because the account is locked out and this triggers the following tasks.
1. Record user's info.
2. Unlock user's account.
3. Verify user has logged in successfully.

Now, the technician will create incident request via a template.In the application, you have set worklog as mandatory.Due to this , the technician has to create a request in open status, then go create work log and close it. 
Using the script,  a worklog will be created based on the values specified in Request additional fields and the request can be automatically closed. 

Execution steps:
1. Download and copy the script file into the \Manageengine\ServiceDesk\integration directory.

2. Open the script using a text editor and update the following values,
      a. Application URL 
      b. Technician Key (Generate it under Personalize >> API Key Generation)
      c.  Additional Field Name (preferably a pick list) to chose whether you want to add the worklog or not. Update the Api name in the script. You can get the api field name under Admin --> Incident additional fields. Refer to the attached screenshot. 
      d. Additional Field value which will trigger the worklog addition.
      e. Technician name needs to be chosen when creating the worklog.
          It can be one of the following options.
             1. $$technicianname$$ (for the technician assigned in the request).
             2. @@technicianname$$ (for the logged in technician)
      f. Request additional field (Date field) from which end time should be populated.
      g. Status to be set in the request. 

3. Configure the script under the  Admin >> Custom Triggers, like shown below.



A short guide on setting up python is available here

                  New to ADManager Plus?

                    New to ADSelfService Plus?