Synchronize Zendesk Tickets With ServiceNow Incidents

This use case describes how to use the Zendesk Adapter to synchronize Zendesk tickets updated at or after a certain time with ServiceNow incidents. The tickets updated in Zendesk are fetched and the details of the ticket are added as an incident in ServiceNow. This implementation pattern provides an overview of the steps.

  1. Create a scheduled orchestrated integration.
  2. Create a schedule variable to store the last run time.
    $lastrun=""
  3. Drag and drop an assign action and create two variables:
    • Flag variable to check whether the loop has completed or not:
      $flag="false"
    • Link variable to store the next page’s value:
      $link=””
  4. Drag a while action and specify the condition as follows:
    $flag="false"
  5. Drag a Zendesk Adapter and configure it as follows.
    1. On the Basic info page, provide an endpoint name, and click Next.
    2. On the Action page, select Query information, and click Next.
    3. On the Operations page, select the Tickets module and Search Zendesk Modules operation, provide a value for the number of records per page, and click Done.
    4. On the Summary page, review your selections, and click Done.
  6. In the mapper, enter the following expression for the Query request parameter.
    concat (dvm:lookupValue ("tenant/resources/dvms/Zendesk_Query_Parameter", 
    "QueryParameter", "Query", "zendesk", "" ), xp20:format-dateTime 
    ($lastrun, "[Y001]-[M01]-[D01]" ) )

    Lookups are used here to pass the value type:ticket updated>= to the parameter query.

  7. Drag a for-each action and assign results as the repeating element.
  8. Drag a ServiceNow Adapter and configure it as follows:
    1. On the Basic info page, provide an endpoint name, and click Next.
    2. On the Action page, select Query Information, and click Next.
    3. On the Operations page, select the Get one or more records from the selected Module/Table based on provided filter parameters operation, Incident application, and Incident module.
    4. On the Summary page, review your selections, and click Done.
  9. Perform the required mapping.
  10. Drag a switch action into the canvas to check whether or not sys_id contains data.
    sys_id=0.0

    When sys_id is null, the incident is created. Otherwise, the existing incident is updated.

  11. Drag a switch action and assign a condition to check whether or not next_page contains data.
    next_page != ""
    1. If the condition statement evaluates to true, assign the link and flag variables as follows:
      $link="next_page"
      $flag=”false”
    2. If the condition statement evaluates to false, assign the flag variable as follows:
      $flag="true"
  12. Update the specified lastrun variable as follows:
    $lastrun=startTime
  13. When complete, save and activate the integration.