Using Web Services to Create a Second Ticket

This how-to article will help Administrators (global and application) to create a ticket in a workflow using Web Services. The user must have the Admin rights for performing these steps.

Overview

Web service steps open up extensive possibilities for managing processes, allowing tickets to be modified, created, or notifications sent out to name a few examples on ticketing workflows. This article serves as an example of adding a ticket workflow step that will create another ticket. This could be if a Ticket comes in for Team A, and there is separate work for this request that Team B must complete, this workflow example will allow that separate ticket to be created for Team B.

Learn more about setting up and using web service steps.

There are several steps needed to set up a workflow step that will create a second ticket:

  1. Define a web service provider and create authentication credentials.
  2. Get the Ticketing Application ID.
  3. Locate the ticket status ID for the new ticket.
  4. Get a ticket source ID for the new ticket.
  5. Get a ticket priority ID for the new ticket.
  6. Locate the ticket classification ID for the new ticket.
  7. Get ticket requestor UID for the new ticket.
  8. Create the web service method.
  9. Test the method.

Creating a Web Service Provider and Auth Account 

Follow the instructions in the Web Service Step article, to learn how to define a web service provider and create authentication credentials.

Getting the Ticketing Application ID

To find the ticket application ID:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the desired Ticketing Application.
  3. In the Application Details window, copy down the ID number located below the application name.

Getting the Ticket Status ID

To get the ticket status ID number for the desired status:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the desired Ticketing Application.
  3. Click Statuses,
  4. then select the ticket ID that you’d like to use for testing.
  5. Best practice is to write down the ID number you need.

Getting the Ticket Source ID

To get a ticket source ID for the new ticket:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the desired Ticketing Application.
  3. Shared settings > Sources. Take note of the number in the ID column.
  4. Best practice is to write down the ID number you need.

Getting the Ticket Priority ID

To get a ticket priority ID for the new ticket:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the desired Ticketing Application.
  3. > Shared Settings > Priorities. Take note of the number in the ID column.
  4. Best practice is to write down the ID number you need.

Getting the Ticket Classification ID

You can find the ticket classification ID for the new ticket in the TeamDynamix API documentation on the ticket classification article.

For example, the number 46 represents a service request. Please note the Classification is required on ticket creation.

Getting a Ticket Requestor UID

To locate a ticket requestor UID for the new ticket:

  1. You can use in the Body of the ticket creation, the value of {{RequestorUID}} and it will get the Requestor’s UID from the originating ticket. Keep in mind the value is case sensitive.

Creating the Web Service Method

To create a web service method that will close your ticket:

  1. In TDAdmin, click Applications in the left navigation.
  2. Click the Name of the Ticketing application you want to add this workflow step to.
  3. Click Workflow Web Services in the left navigation, then click Web Service Methods.
  4. Click the +New button.
  5. On the New Web Service page, enter a Name for the method. This name will show up in the workflow builder.
  6. In the Web Service Provider field, select the web service provider you've already defined
  7. Click the Method button to the left of the URL field and select POST.
  8. In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/[Your Ticket App ID]/tickets. EX: https://wcsandbox.teamdynamix.com/TDWebApi/api/####/tickets
  9. Click the Headers tab and define one of the following headers:
    1. Key – Content-type
    2. Value – application/json 
  10. Click the Add button to add the header.
  11. Click the Parameters tab and define the following parameter:
    1. NameOrigTicketID
    2. Type – String
    3. Data source – From Ticket
    4. Source property – ID
    5. Click the Add button to add the parameter.
  12. If you will be using custom attributes on the new ticket, add additional parameters for each custom attribute you want to copy into the new ticket.
    1. Name – Enter the name of your custom attribute
    2. Type – string
    3. Data source – From Ticket
    4. Source property – Pick the appropriate custom attribute from the list
    5. Click the Add button to add the parameter
  13. Click the Body tab and type or paste the following:
    1. {
      "TypeID":[Ticket Type ID],
      "FormID":[ID of the desired form],
      "Title":"Example ticket title",
      "Description":"Created from ticket {{OrigTicketID}}",
      "AccountID":[Acct/Dept ID],
      "SourceID":[Source ID],
      "StatusID":[Status ID],
      "PriorityID":[Status ID],
      "RequestorUID":"[Requestor UID]"
      "Attributes":
        [
          { "Name": "Custom Attribute Name 1", "ID": [Custom attribute ID], "Value": "[Choice ID, {{parameter}}, or text]" },
          { "Name": "Custom Attribute Name 2", "ID": [Custom attribute ID], "Value": "[Choice ID, {{parameter}}, or text]" },
          { "Name": "Custom Attribute Name 3", "ID": [Custom attribute ID], "Value": "[Choice ID, {{parameter}}, or text]" },
        ] 
      }
      

      Replace each of the [bracketed] sections with the appropriate ID. For custom attribute values replace the [bracketed] section with the appropriate parameter name in {{braces}} from step 12, or use the choice ID of the custom attribute choice (for choice-based fields like dropdowns or checkboxes), or enter text (for text-based fields like textareas or textboxes).

Testing the Method

You will need a ticket ID number to use for testing.

To test the new method:

  1. Click the Authentication tab and select your TeamDynamix web service account.
  2. Click the Save button.
  3. In the web service, select Test
  4. In the OrigTicketId column, along with any other value IDs that are missing
  5. Click the Send button
  6. Verify the output
  7. This web service method can now be included in a ticket workflow. Learn more about adding a web service step to a workflow.
0% helpful - 1 review

Details

Article ID: 18608
Created
Wed 11/16/16 4:11 PM
Modified
Tue 9/20/22 4:50 PM