This how-to article will help Administrators to use Workflow Web Services to create a multi-level approval workflow based on ReportsTo data in theTDAdmin interface. The user must have Administrator access in TDAdmin.
Overview
Web service steps open up extensive possibilities for things that can occur on a ticket within TeamDynamix as part of a ticketing workflow. This article serves as an example of adding multiple approval layers based on the ReportsTo data. For example, a request may be approved by the Requestor's Supervisor and the Supervisor's Supervisor.
Learn more about setting up and using web service steps.
There are a few steps needed to set up the web service steps for the workflow:
- Get Requestor Data - ReportsToUID from People Records
- Write the Supervisor to a custom "Approver1" attribute on the ticket
- Get Supervisor Data - ReportsToUID from People Records
- Write the Supervisor's Supervisor to a custom "Approver2" attribute on the ticket
- Create Approval Workflow Steps - Use the Approver1 and Approver2 attributes as Approval Roles
Preparing Custom Attributes
- In TDAdmin, click Applications in the left navigation.
- Click the Name of the Ticketing application you want to add this workflow to.
- Click Attributes in the left nvigation.
- Select +New from the top navigation
- Attribute Name: Approver1
- Header Text: Approver1
- Attribute Type: Person
- Save
- Note the ID under the attribute name at the top of the pop-out window. This will be needed later.
- Repeat Step 4 to create an Approver2 attribute.
Creating the Web Service Method - Get Requestor Data
This Web Service Method will retrieve information about the Requestor.
- 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. (Suggested: Get Requestor Data)
- In the Web Service Provider field, enter the web service provider you've already defined.[where?]
- Click the Method button to the left of the URL field and select GET.
- In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/people/{{RequestorUID}}
- Click the Headers tab and define the following header:
- Key – Content-type
- Value – application/json
- Click the Add button to add the header.
- Click the Parameters tab and define one of the following parameters:
- RequestorUID – String – From Ticket – Requestor UID
- Click the Add button to add the parameter.
- Click Authentication and select and Auth method that has access to People records.
- Click the Save button.
The Body field is intentionally left blank, GET requests should have no body value.
Storing the Get Requestor Data Results in the Workflow
Add a workflow step to call the Get Ticket Details method (from above) and store the results in the workflow with a meaningful name, such as REQUESTORDATA. Whatever you name the result is how you will need to reference it in a the next web service method.
Creating the Web Service Method - Write the Supervisor to Approver1
This Web Service Method will update the ticket by setting Approver1 to the Requestor's "ReportsTo" Supervisor.
- 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. (Suggested: Write Supervisor to Approver1)
- In the Web Service Provider field, enter the web service provider you've already defined.[where?]
- Click the Method button to the left of the URL field and select PATCH.
- In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/{{AppID}}/tickets/{{TicketID}}
- Click the Headers tab and define the following header:
- Key – Content-type
- Value – application/json
- Click the Add button to add the header.
- Click the Parameters tab and define one of the following parameters:
- AppID – Integer – From Ticket – Application ID
- TicketID – Integer – From Ticket – ID
- ReportsToUID - String - From Workflow - REQUESTORDATA.ReportsToUID
- Click the Add button to add the parameter.
- Click </> Body tab
-
[ {"op": "replace", "path": "/attributes/XXXX", "value": "{{ReportsToUID}}"}]
- Replace XXXX with the custom attribute ID number from the "Approver1" attribute created at the beginning of this article.
- Click Authentication and select and Auth method that has access to People records.
- Click the Save button.
Creating the Web Service Method - Get Supervisor Data
This Web Service Method will retrieve information about the Requestor's Supervisor.
- 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. (Suggested: Get Supervisor Data)
- In the Web Service Provider field, enter the web service provider you've already defined.[where?]
- Click the Method button to the left of the URL field and select GET.
- In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/people/{{SupervisorUID}}
- Click the Headers tab and define the following header:
- Key – Content-type
- Value – application/json
- Click the Add button to add the header.
- Click the Parameters tab and define one of the following parameters:
- SupervisorUID – Integer – From Workflow – REQUESTORDATA.ReportsToUID (Note: "REQUESTORDATA" is the response body name defined in Step 2)
- Click the Add button to add the parameter.
- Click Authentication and select and Auth method that has access to People records.
- Click the Save button.
The Body field is intentionally left blank, GET requests should have no body value.
Storing the Get Supervisor Data Results in the Workflow
Add a workflow step to call the Get Ticket Details method (from above) and store the results in the workflow with a meaningful name, such as SUPERVISORDATA. Whatever you name the result is how you will need to reference it in a the next web service method.
Creating the Web Service Method - Write Supervisor's Supervisor to Approver2
This Web Service Method will update the ticket by setting Approver2 to the Requestor's Supervisor's "ReportsTo" Supervisor.
- 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. (Suggested: Write Supervisor's Supervisor to Approver2)
- In the Web Service Provider field, enter the web service provider you've already defined.[where?]
- Click the Method button to the left of the URL field and select PATCH.
- In the URL field, enter https://[Your TeamDynamix URL]/TDWebApi/api/{{AppID}}/tickets/{{TicketID}}
- Click the Headers tab and define the following header:
- Key – Content-type
- Value – application/json
- Click the Add button to add the header.
- Click the Parameters tab and define one of the following parameters:
- AppID – Integer – From Ticket – Application ID
- TicketID – Integer – From Ticket – ID
- ReportsToUID - String - From Workflow - SUPERVISORDATA.ReportsToUID
- Click the Add button to add the parameter.
- Click </> Body tab
-
[ {"op": "replace", "path": "/attributes/XXXX", "value": "{{ReportsToUID}}"}]
- Replace XXXX with the custom attribute ID number from the "Approver2" attribute created at the beginning of this article.
- Click Authentication and select and Auth method that has access to People records.
- Click the Save button.
- Create Approval Workflow Step for Approver1
- Choose Approver1 as the Approver Role
- Create Approval Workflow Step for Approver2
- Choose Approver2 as the Approver Role