Create a Request in ServiceDesk

Table of ContentsDown

Overview

The create SDPOD integration task in Zoho Creator can be used to create a request in ServiceDesk Plus OnDemand. For example, you can create a request to book a conference hall, in which you can mention your requirements about the booking. The request is submitted to the concerned department which makes arrangements for the request. The request is initiated in Zoho Creator by adding code to a form, which upon submission, creates a request in ServiceDesk Plus OnDemand.

Syntax

<response>= zoho.sdpod.create(moduleName, params);

where,
<response> is the map variable returned as response. It contains the details of the newly created request.
<moduleName> refers to the module in ManageEngine ServiceDesk Plus. As of now Request is the only supported Module.
<params> is the map variable that holds the key,value pairs. The map key is the label name as specified in the ServiceDesk Plus OnDemand Requests module. The map value is the field value as submitted in the ZC form.

Example - Using script-builder

In this example, a request is made to book a conference hall with a set of customised request values. We will create a Zoho Creator form with fields for the request values. Then, using script-builder, we will create the equivalent script. Upon submission of the form the code gets executed and, based on the selected values, the request gets created in ServiceDesk Plus OnDemand.

  1. Create a Zoho Creator form with the following fields
  • Host
  • Conference Hall Booking
  • Department
  • RoomName
  • StartTime
  • EndTime
  • Count
  • Equipments
  • Click on Workflow to open the scriptbuilder. Go to the On Add - On Success section.
  • Drag-and-drop the "call function" task under "Miscellaneous" tasks in Zoho Creator to select the request values.
  • Select Integration tasks.
  • Set "Select Service" as SDPOnDemand.
  • Set "Select Function" as Create.
  • Set "Module Name" as Requests.
  • Set "Requester" as "Host" using the Zoho Creator fields.
  • Set "Select a Template" as "Default Request".
  • Click on "New Map" to add key-value pairs.
  • Select the following key-value pairs and click on Done
    "HOST" : Host, "DEPARTMENT" : Department, "ROOMNAME" : RoomName, "STARTTIME" : StartTime, "ENDTIME" : EndTime, "ATTENDEESCOUNT": Count, "EQUIPMENTSREQUIRED": Equipments
  • Click on Done to insert the call function task.


Upon submission of the form, a request gets created in ServiceDesk Plus OnDemand with the declared values

Note

  • The key-value pairs displayed will differ based on the template selected

Example - Using free-flow scripting

Instead of using the script-builder you can also use the free-flow scripting to directly insert the code in the editor box.

  1. Click on Workflow to open the scriptbuilder. Go to the On Add - On Success section and navigate to Free-flow Scripting.
  2. Now add the following code in the editor box and click on "Save"

    // declare the map variable to hold key-value pairs
    params = {"REQUESTER" : input.Host, "REQUESTTEMPLATE" : input.Conference_Hall_Booking", "HOST" : input.Host, "DEPARTMENT" : input.Department, "ROOMNAME" : input.RoomName, "STARTTIME" : input.StartTime, "ENDTIME" : input.EndTime, "ATTENDEESCOUNT": input.Count, "EQUIPMENTSREQUIRED": input.Equipments};

    // create a request by executing the syntax
    response = zoho.sdpod.create("Requests", params);

    where,
    params contains the key-value pairs. The keys refer to the label names in ServiceDesk Plus OnDemand. and the values refer to the values of Zoho Creator field values. For example, "REQUESTER" is the label name in ServiceDesk and input.Host is the value entered in the "Host" field of ZC form.
    response is the map variable returned as response. It contains the details of the newly created request.
    Requestsstands for the module name in ServiceDesk Plus OnDemand. As of now, Requests is the only supported module.

  3. Upon submission of the form, a request gets created in ServiceDesk Plus OnDemand with the declared values.
  4. In this example, successful execution of the syntax will yield the following response:
    response = { "status" : "Success" , "WORKORDERID" : "1000", "REQUESTER": "Howard Stern", "REQUESTTEMPLATE": "Request", "HOST": "John", "DEPARTMENT": "HR", "ROOMNAME": "Resolve", "STARTTIME" : "09:00:00", "ENDTIME" : "10:00:00", "ATTENDEESCOUNT": "15", "EQUIPMENTSREQUIRED": "Chairs"};
  5. If for some reason, the execution fails, the response will be of the following format:
    response = {"status" : "Failure" , "message" : "<error message>"};

Retrieve Request ID

To obtain the ID of the newly created request, add the following code:

reqID = response.get("WORKORDERID").toLong();

Share this post : FacebookTwitter