Using Web Services to Create a Ticket Task

This how-to article will help Administrators (global and application) to create an ad-hoc task 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 task. While you can use Task steps in ticket workflows to create a task, you may want to create tasks in a more dynamic way: for example, customizing the title, description, start or due date based on the parent ticket data. Note that the created task is a Ticket Task, not a Workflow Task - it will exist "outside" of the ticket workflow and will not be part of the workflow's logic or activity flow.

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 task:

  1. Define a web service provider and create authentication credentials.
  2. Get the Ticketing Application ID.
  3. Get the responsible person UID for the new task.
  4. Get the responsible group ID for the new task.
  5. Create the web service method.
  6. 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 a Task Responsible Person UID

To get the UID string for the desired responsible person:

  1. In TDAdmin, click Users & Roles in the left navigation, then click Users.
  2. Search for the the user you'd like to use, then click on their name to open their record.
  3. The address bar of the browser window with the user's record will look similar to this:
    https://example.teamdynamix.com/TDAdmin/Users/Edit.aspx?U=88faa06b-e9ce-eb11-a7ad-dc98408d7262
  4. The 36-character string of the URL after ?U= is the user's UID. Copy this down to use later.

Getting a Task Responsible Group ID

To get the ID number for the desired responsible group:

  1. In TDAdmin, click Users & Roles in the left navigation, then click Groups.
  2. Find the group ID that you’d like to use for testing.
  3. Best practice is to write down the ID number you need.

Creating the Web Service Method

To create the web service method:

  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 TDX URL]/TDWebApi/api/{{appId}}/tickets/{ticketId}/tasks.
    1. Example: https://example.teamdynamix.com/TDWebApi/api/{{appId}}/tickets/{{ticketId}}/tasks
  9. Click the Headers tab and define one of the following headers:
    1. Key – Content-type
    2. Value – application/json 
    3. Click the Add button to add the header.
  10. Click the Parameters tab and define the following parameters:
    1. NameticketId
      1. Type – String
      2. Data source – From Ticket
      3. Source property – ID
      4. Click the Add button to add the parameter.
    2. (optional) NamestartDate
      1. Type – String
      2. Data source – From Ticket
      3. Source property – Select the appropriate field or custom attribute.
      4. Click the Add button to add the parameter.
    3. (optional) NameendDate
      1. Type – String
      2. Data source – From Ticket
      3. Source property – Select the appropriate field or custom attribute.
      4. Click the Add button to add the parameter.
  11. Click the Body tab and type or paste the following:
    1. {
      "Title":"Example task title",
      "Description":"Example task description",
      "ResponsibleUid": [Responsible Person UID],
      "ResponsibleGroupID": [Responsible Group ID],
      "StartDate": {{startDate}},
      "EndDate": {{endDate}}
      }
      

      Replace each of the [bracketed] sections with the appropriate ID. Do not include the brackets. 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 ticketId field, enter a test ticket ID (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.
Print Article

Details

Article ID: 159754
Created
Mon 6/10/24 11:05 AM