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:
- Define a web service provider and create authentication credentials.
- Get the Ticketing Application ID.
- Get the responsible person UID for the new task.
- Get the responsible group ID for the new task.
- Create the web service method.
- 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:
- In TDAdmin, click Users & Roles in the left navigation, then click Users.
- Search for the the user you'd like to use, then click on their name to open their record.
- 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
- 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:
- In TDAdmin, click Users & Roles in the left navigation, then click Groups.
- Find the group ID that you’d like to use for testing.
- Best practice is to write down the ID number you need.
Creating the Web Service Method
To create the web service method:
- In TDAdmin, click Applications in the left navigation.
- Click the Name of the Ticketing application you want to add this workflow step to.
- Click Workflow Web Services in the left navigation, then click Web Service Methods.
- Click the +New button.
- On the New Web Service page, enter a Name for the method. This name will show up in the workflow builder.
- In the Web Service Provider field, select the web service provider you've already defined
- Click the Method button to the left of the URL field and select POST.
- In the URL field, enter
https://[Your TDX URL]/TDWebApi/api/{{appId}}/tickets/{ticketId}/tasks
.
- Example:
https://example.teamdynamix.com/TDWebApi/api/{{appId}}/tickets/{{ticketId}}/tasks
- Click the Headers tab and define one of the following headers:
- Key – Content-type
- Value – application/json
- Click the Add button to add the header.
- Click the Parameters tab and define the following parameters:
- Name – ticketId
- Type – String
- Data source – From Ticket
- Source property – ID
- Click the Add button to add the parameter.
- (optional) Name – startDate
- Type – String
- Data source – From Ticket
- Source property – Select the appropriate field or custom attribute.
- Click the Add button to add the parameter.
- (optional) Name – endDate
- Type – String
- Data source – From Ticket
- Source property – Select the appropriate field or custom attribute.
- Click the Add button to add the parameter.
- Click the Body tab and type or paste the following:
-
{
"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:
- Click the Authentication tab and select your TeamDynamix web service account.
- Click the Save button.
- In the web service, select Test
- In the ticketId field, enter a test ticket ID (along with any other value IDs that are missing)
- Click the Send button
- Verify the output
- This web service method can now be included in a ticket workflow. Learn more about adding a web service step to a workflow.