Create or change an API template
A Dynamo Task API compatible application template (DAP) can be created and tested using the Dynamo Template Builder.
If Task API has not been already enabled for your organization, send email to support@documill.com to request trial license.
Template Builder steps
Create a new custom template by selecting “Task API” or other master template
Select a main object
Add content to the document template
Do a test run by clicking the “Test” button (see chapter “Testing” for more info)
Template logic can be configured further from the “Settings” tab
Click on the “Save” button to save the template to Salesforce
Testing
If “Task API” has been selected as the master template you have two testing options:
Testing with UI
Testing with API
Testing with UI
Click the Test button in the main ribbon. If the test parameter is “test=true”, the resulting document will immediately be shown in a special test screen. The test screen is not used in real API use.
Clicking on the “Continue” button will either save the document to Salesforce, send it via email, or both, depending on template settings. Clicking on the “End” button will end the test run without any further actions.
When the test run is over, the debug view will show if it’s enabled. This is a good way to do iterative testing until the document looks as desired.
Next, testing should continue with real API to be sure that result is as expected.
Testing with API
This testing method will use real API and requires that API is enabled and org has API tasks left.
![image-20240104-073034.png](../__attachments/157384705/image-20240104-073034.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Enable “API” button from settings if it’s not already visible in the ribbon.
Settings -> Template Builder -> API -> Show API button: on
![image-20240104-073504.png](../__attachments/157384705/image-20240104-073504.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Click “API” button to see API view.
![image-20240104-073127.png](../__attachments/157384705/image-20240104-073127.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Add required parameters such as “id” with values (id is typically the Salesforce test record id)
Click on the “Send” button.
If all went well, a response code 202 will be shown, meaning that Dynamo accepted the API request.
Click on the “Refresh” button to see the API task status.
Status responses tells if the API task is ready and if any errors occurred during the process. Click on the “Refresh” button for each “Ready” message.
Check the response JSON. If the “error” property is true, it means the task produced one or more errors. See the “log” property for more info.
Using DAP outside Template Builder
When a DAP is saved to Salesforce it can be used e.g. from Salesforce flow.
Automatic variable
DAP logic can use automatic variable:
dynamoAPI.taskID
Returns current task ID.