Using Workato to add a table in Confluence
Recently, a customer asked if we can create a table in Confluence. The answer is “Yes we can”.
I thought it was a good question and so I’m penning this down for future references.
Here’s our envisioned table in Confluence:
We want to see a table in Confluence. And we can do so by inserting HTML into the body of the page.
Reference recipe
Here is the recipe that we will be using for this guide. Link here.
Off the top of my head, I’ll say we can achieve this with message template (Step 6 of above recipe) because it is neater. You can generate dynamically the number of rows or columns that you will need. However, if you don’t have the rights to create/view message template (Step 7 of above recipe), there’s a section below on how you can still achieve creating a table.
Note that step 2 — 4 are there to create a list variable for my Confluence table. You don’t have to do this step if you have a list coming in from other steps e.g. list of objects from Salesforce.
Use message template
You can find message template under the Tools menu. Message template is a reusable component for Workato Recipes.
And here’s how our template will look like
Here’s the message template:
<p class=”auto-cursor-target”><br /></p><table>
<colgroup>
<col />
<col />
</colgroup>
<tbody>
<tr><th>{{ColumnHeader1}}</th><th>{{ColumnHeader2}}</th></tr>
{{#tabledata}}
<tr>
<td>{{Field1}}</td>
<td>{{Field2}}</td>
</tr>
{{/tabledata}}
</tbody>
</table><p><br /></p>
Now, let’s switch back to the recipe canvas.
Add a step “Create message using template”
In this step, you can configure the fields that you want to display in your Confluence table. If you want the value to be dynamically populated based on a datapill. you can map it to the fields.
And with that, we can go ahead to map the datapill output of the message template step to the “Create page in Confluence” step.
With that, we’re done. Go ahead and click on the test button on the top right-hand corner.
Not using message template
If you don’t have message template rights, we can still proceed. Except it will look slightly messier. You will write the html code directly on the Body.
If you need to put in dynamic datapills, remember to toggle to formula mode and add the double quotes “” and + sign.
One thing to note when not using message template, you will not be able to dynamically generate rows/columns according to your list/array size. You will need to hard code it.
Hopefully this was a useful guide for you on how to create tables in Confluence.
As shown in this example, generating notifications or pages more often than not require some sort of template. Message templates in Workato allows reusability of the template and allow you to put in dynamic values within it.