Automation Cloud - Buttons for in Express Approvals

  • 8 November 2022
  • 5 replies
  • 895 views

Userlevel 5
Badge +13
  • Nintex Employee
  • 263 replies

Workflow Export Key:

Q54w8FBLY7qpShZLdbiHok9thBhoq7VYMLyACf4mYJtLcAest

 

Hello,

 

In this blog I am going to show you how you can add buttons to express approval emails to speed up the time it takes to respond, currently when you receive an express approval email you are asked to hit reply and type out your response, this can sometimes lead to mistakes in spelling, although already quite fast in relative terms, we can always improve and make them look like this:

 

27074i07CD4870F437FF66.png

 

I will be adding an export of this solution to the gallery if you prefer to skip some steps below but I recommend you keep reading to understand how it is configured.

 

Before we begin there is a couple things we need to do for this workflow.

 

First we need to generate an App token for Nintex Automation Cloud, If you haven't already got one. 

 

Once you have created your app token you'll need to copy and keep safe the client ID and Secret by clicking on the ellipsis and then View.

 

27036i8D5B925279CF4CB1.png

 

27035iCEE4B4419EBB606D.png

 

After that we need to create a new workflow cloud connection. you can either do this now or in the workflow later inside the action.

 

You will also need to copy your Nintex Automation Cloud Tenant ID, this is shown on your settings page labelled 'Tenancy ID'.

 

To start, create a new workflow with a Nintex start form, inside that start form you only need a single email field for this demonstration.

 

27037iD926E39064CB32A4.png

 

The next important step is to add a variable to store the Tenancy you obtained earlier, you can do this in 2 ways.

 

You can create a new variable and set the default value to the Tenancy ID, as this never changes it is perfectly suitable.

 

27038iE65AC5344E234391.png

 

The other method is to create a Tenancy ID Variable but use a workflow action to set the variable.

 

27039i5E1E107FB090C9B7.png

 

I prefer the former but the latter is perhaps more intuitive to any admins later on as it is clear the action is setting the variable, where as the default value setting is slightly more obfuscated.

 

The next step is to add a parallel paths action to the workflow, to keep things simple, label the first branch 'Task Branch' and the second branch 'Email Branch'.

 

The reason we need a parallel path is the task ID is required in the process, this isn't generated in the workflow until after the task is created, as such it is not currently possible to reference that ID inside the task its self at this time.

 

27040iFE7039D95D292D1D.png

 

First let's focus on the Task Branch by adding an approval task and select the task type 'Express Approval'

 

27041i35F7FA79EFA4D7D7.png

 

Configure the task as you normally would but for simplicity, leave the Outcomes as default for now and use the Email for the approver from the start form in the Assignee field. 

 

27043iF885B14350BC8824.png

 

So an important component of making this process work we need to find a way to make sure that the email from this task never sends, to do this we are going to invalidate the email in the task, to do that follow these steps:

 

  1. You need to have a Subject defined or the workflow will error
  2. Create a new variable and call it null, place no default value so it is empty
  3. Use the null variable as the message body
  4. Turn off the footer text

If you follow these steps on a task, the task will generate and appear in Nintex but an email will not send, I believe this is because the message body is empty even though it is a required field.

 

Please note: that this isn't an officially supported capability for turning off emails from tasks, hopefully this is something we can add soon, a more consistent but less convenient way would be to allow 'Any email address' to respond to the task then assign the task to a shared mailbox, that way the email will still send but not to the intended person.

 

With that created, the Task Branch is complete, let's move onto the Email Branch.

 

On the email branch we need to wait for the tasks to be generated before continuing, A nice way I have found to do that is to start a loop, Get the tasks from the Nintex Workflow Instance and count them, If there are no tasks then repeat the loop, that way you don't need to use a 'wait for duration' action permanently limiting your workflow speed.

 

To do this add the following actions in this order.

27044iF9E877BF6E25CB3C.png

 

To start we need to work backwards a little and configure the Get Tasks and Count items in collection actions first.

 

Start by configuring the get tasks action as follows:

Here you will be using the Nintex Automation Cloud connection we created earlier or if you haven't done that yet you can create one here with the Client ID and Secret obtained earlier.

 

  1. Insert the variable for the current workflow instance ID from Insert>Context>Workflow instance ID
  2. Set Status to Active
  3. Start and End date are not required
  4. Create a new output object, I named mine 'Tasks'

27045i3A1DAE31B20E5720.png

 

Now we have an object variable named Tasks that contains all of the tasks for this instance, we can use this object to determine the number of task active on the workflow and what their IDs are.

 

27046iF924A6950FF42567.png

 

The next step is to count those tasks so to do that we use the 'Count items in collection' action.

To configure it, target the collection Tasks>Tasks collection.

 

27047iACE3E72B3E9CA19C.png

 

Create a new Integer variable named 'Total Tasks' and insert that.

 

Now we have gathered that information we can configure the loop as shown below.

 

27048i2A9AE640E38D587F.png

 

In this example using this logic where Total Tasks = 0 the loop will continue until this is no longer true, so in our scenario as soon as the first task is detected the loop will stop.

 

You can configure the loop to detect specific number of assignments if you use multi-assign tasks, you just need to ensure you know what that number is and set the 0 function to that number, then if you know you are waiting for 4 tasks, use the logic 'Total Tasks' does not equal 4

 

In the next step we need to extract some information from these tasks, mainly the Task ID but I also like to get the Assignee and also the Subject of the task email.

 

To do that we need to create a loop inside a loop containing a 'Create a text string' action followed by a 'Send an email' action as shown below.

 

27049i6898EC12FAFB0C8A.png

 

In the first look for each action, target the Tasks collection by going Insert>Nintex Workflow Cloud>Tasks>Tasks as below.

 

27050i0609317E7A047335.png

 

It should look like this:

27051i6720F723BF2602FB.png

 

I like to name the loop now just so that I know which loop is which later on so I named the outer-most loop 'Loop for each task instance'

 

Now on the inside loop name that 'Loop for each task assignment' and point that to the first loops Task assignments by going Insert>Loop for each>Loop for each task instance>Current Item>Task assignments as shown below

 

27053i9633C46107024E45.png

27055i263493BF603DB95D.png

 

Now for the fun part we need to build the buttons.

 

Emails support basic inline HTML so we can use that to create some buttons, I have made an example below you are welcome to copy or if you prefer to use your own code thats fine.

 

In the create a text string variable paste the following HTML code and store into a variable named 'Outcome Buttons'

 

The code looks a little bit messy but there is some changes we need to make to get it to work, inside the code you will find the following placeholders: {{Tenant ID}}​, {{Task ID}}​ and {{Subject}}​ in 2 different lines starting with '<a href='

 

These placeholders need to be replaced with variables from the workflow for now just paste the code in as is.

 

 

​<table width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" style="text-align: center"> <a href="mailto:​‍‍{{Tenant ID}}​_task-manager_​‍{{Task ID}}​@eu.workflowcloud.com?subject=Re:{{Subject}}&body=Reject" style="width:80%; min-width: 70px; max-width:200px; border: 1px solid #dc3545;border-radius: 4px;font-family: Helvetica, Arial, sans-serif;font-size: clamp(16px, 4vw, 20px); color: #fff;background-color:#dc3545; text-decoration: none;font-weight:bold;display: inline-block;"><div style="margin: 15px 30px;">Reject</div></a> </td> <td width="50%" style="text-align: center"> <a href="mailto:​‍‍{{Tenant ID}}​_task-manager_​‍{{Task ID}}​@eu.workflowcloud.com?subject=Re:{{Subject}}&body=Approve" style="width:80%; min-width: 70px; max-width:200px; border: 1px solid #28a745;border-radius: 4px;font-family: Helvetica, Arial, sans-serif;font-size: clamp(16px, 4vw, 20px); color: #fff;background-color:#28a745; text-decoration: none;font-weight:bold;display: inline-block;"><div style="margin: 15px 30px;">Approve</div></a> </td> </tr> </table>​

 

 

 

At first the placeholders will be plain text like this:

 

27062iD7291F05A8D63CE1.png

To replace them just highlight them, remove and hit insert.

 

For the Tenant ID this is the variable we created near the start

For the Task ID we can use Insert>Loop for each>Loop for each task instance>Current Item>ID

For the Subject select Insert>Loop for each> Loop for each task instance>Current Item>Subject

 

Be sure to replace all 6 placeholders, there are 3 for each button with 2 buttons in the code.

 

Next step is to configure the email as below.

 

The Assignee is selected by choosing Insert>Loop for each>Loop for each task assignment>Current item>Assignee

 

The Subject is the same as the subject placeholder above.

 

The outcome buttons are the variable stored using the build a text string action above.

 

Feel free to add any other messages before or after the buttons and configure anything else as you normally would in the task.

 

27063i59D6197B226A1070.png

 

Now our workflow is ready to test it should look like this:

 

27066iC64BF7D028201BCF.png

 

If you run your new workflow and put your email in the start form you will receive an email like this:

27068iCC8A0E43E77A9F2E.png

 

If you click on either Reject or Approve it will open a reply email for you with the message body pre-filled all you need to do is hit send. 

27071iF2D7CD620C7BCBB4.png

 

As we are only using standard supported HTML links, this method should work on any modern device/email browser, I cannot however guarantee the same look and feel for all devices with the buttons, for example on a Mac you may find the text inside the buttons turns blue.

 

Thank you so much reading along, I hope this blog was insightful and helpful to you.

 

Jake

 


5 replies

Userlevel 4
Badge +14

Hello,

 

In this blog I am going to show you how you can add buttons to express approval emails to speed up the time it takes to respond, currently when you receive an express approval email you are asked to hit reply and type out your response, this can sometimes lead to mistakes in spelling, although already quite fast in relative terms, we can always improve and make them look like this:

 

27074i07CD4870F437FF66.png

 

I will be adding an export of this solution to the gallery if you prefer to skip some steps below but I recommend you keep reading to understand how it is configured.

 

Before we begin there is a couple things we need to do for this workflow.

 

First we need to generate an App token for Nintex Automation Cloud, If you haven't already got one. 

 

Once you have created your app token you'll need to copy and keep safe the client ID and Secret by clicking on the ellipsis and then View.

 

27036i8D5B925279CF4CB1.png

 

27035iCEE4B4419EBB606D.png

 

After that we need to create a new workflow cloud connection. you can either do this now or in the workflow later inside the action.

 

You will also need to copy your Nintex Automation Cloud Tenant ID, this is shown on your settings page labelled 'Tenancy ID'.

 

To start, create a new workflow with a Nintex start form, inside that start form you only need a single email field for this demonstration.

 

27037iD926E39064CB32A4.png

 

The next important step is to add a variable to store the Tenancy you obtained earlier, you can do this in 2 ways.

 

You can create a new variable and set the default value to the Tenancy ID, as this never changes it is perfectly suitable.

 

27038iE65AC5344E234391.png

 

The other method is to create a Tenancy ID Variable but use a workflow action to set the variable.

 

27039i5E1E107FB090C9B7.png

 

I prefer the former but the latter is perhaps more intuitive to any admins later on as it is clear the action is setting the variable, where as the default value setting is slightly more obfuscated.

 

The next step is to add a parallel paths action to the workflow, to keep things simple, label the first branch 'Task Branch' and the second branch 'Email Branch'.

 

The reason we need a parallel path is the task ID is required in the process, this isn't generated in the workflow until after the task is created, as such it is not currently possible to reference that ID inside the task its self at this time.

 

27040iFE7039D95D292D1D.png

 

First let's focus on the Task Branch by adding an approval task and select the task type 'Express Approval'

 

27041i35F7FA79EFA4D7D7.png

 

Configure the task as you normally would but for simplicity, leave the Outcomes as default for now and use the Email for the approver from the start form in the Assignee field. 

 

27043iF885B14350BC8824.png

 

So an important component of making this process work we need to find a way to make sure that the email from this task never sends, to do this we are going to invalidate the email in the task, to do that follow these steps:

 

  1. You need to have a Subject defined or the workflow will error
  2. Create a new variable and call it null, place no default value so it is empty
  3. Use the null variable as the message body
  4. Turn off the footer text

If you follow these steps on a task, the task will generate and appear in Nintex but an email will not send, I believe this is because the message body is empty even though it is a required field.

 

Please note: that this isn't an officially supported capability for turning off emails from tasks, hopefully this is something we can add soon, a more consistent but less convenient way would be to allow 'Any email address' to respond to the task then assign the task to a shared mailbox, that way the email will still send but not to the intended person.

 

With that created, the Task Branch is complete, let's move onto the Email Branch.

 

On the email branch we need to wait for the tasks to be generated before continuing, A nice way I have found to do that is to start a loop, Get the tasks from the Nintex Workflow Instance and count them, If there are no tasks then repeat the loop, that way you don't need to use a 'wait for duration' action permanently limiting your workflow speed.

 

To do this add the following actions in this order.

27044iF9E877BF6E25CB3C.png

 

To start we need to work backwards a little and configure the Get Tasks and Count items in collection actions first.

 

Start by configuring the get tasks action as follows:

Here you will be using the Nintex Automation Cloud connection we created earlier or if you haven't done that yet you can create one here with the Client ID and Secret obtained earlier.

 

  1. Insert the variable for the current workflow instance ID from Insert>Context>Workflow instance ID
  2. Set Status to Active
  3. Start and End date are not required
  4. Create a new output object, I named mine 'Tasks'

27045i3A1DAE31B20E5720.png

 

Now we have an object variable named Tasks that contains all of the tasks for this instance, we can use this object to determine the number of task active on the workflow and what their IDs are.

 

27046iF924A6950FF42567.png

 

The next step is to count those tasks so to do that we use the 'Count items in collection' action.

To configure it, target the collection Tasks>Tasks collection.

 

27047iACE3E72B3E9CA19C.png

 

Create a new Integer variable named 'Total Tasks' and insert that.

 

Now we have gathered that information we can configure the loop as shown below.

 

27048i2A9AE640E38D587F.png

 

In this example using this logic where Total Tasks = 0 the loop will continue until this is no longer true, so in our scenario as soon as the first task is detected the loop will stop.

 

You can configure the loop to detect specific number of assignments if you use multi-assign tasks, you just need to ensure you know what that number is and set the 0 function to that number, then if you know you are waiting for 4 tasks, use the logic 'Total Tasks' does not equal 4

 

In the next step we need to extract some information from these tasks, mainly the Task ID but I also like to get the Assignee and also the Subject of the task email.

 

To do that we need to create a loop inside a loop containing a 'Create a text string' action followed by a 'Send an email' action as shown below.

 

27049i6898EC12FAFB0C8A.png

 

In the first look for each action, target the Tasks collection by going Insert>Nintex Workflow Cloud>Tasks>Tasks as below.

 

27050i0609317E7A047335.png

 

It should look like this:

27051i6720F723BF2602FB.png

 

I like to name the loop now just so that I know which loop is which later on so I named the outer-most loop 'Loop for each task instance'

 

Now on the inside loop name that 'Loop for each task assignment' and point that to the first loops Task assignments by going Insert>Loop for each>Loop for each task instance>Current Item>Task assignments as shown below

 

27053i9633C46107024E45.png

27055i263493BF603DB95D.png

 

Now for the fun part we need to build the buttons.

 

Emails support basic inline HTML so we can use that to create some buttons, I have made an example below you are welcome to copy or if you prefer to use your own code thats fine.

 

In the create a text string variable paste the following HTML code and store into a variable named 'Outcome Buttons'

 

The code looks a little bit messy but there is some changes we need to make to get it to work, inside the code you will find the following placeholders: {{Tenant ID}}​, {{Task ID}}​ and {{Subject}}​ in 2 different lines starting with '<a href='

 

These placeholders need to be replaced with variables from the workflow for now just paste the code in as is.

 

 

​<table width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="50%" style="text-align: center"> <a href="mailto:​‍‍{{Tenant ID}}​_task-manager_​‍{{Task ID}}​@eu.workflowcloud.com?subject=Re:{{Subject}}&body=Reject" style="width:80%; min-width: 70px; max-width:200px; border: 1px solid #dc3545;border-radius: 4px;font-family: Helvetica, Arial, sans-serif;font-size: clamp(16px, 4vw, 20px); color: #fff;background-color:#dc3545; text-decoration: none;font-weight:bold;display: inline-block;"><div style="margin: 15px 30px;">Reject</div></a> </td> <td width="50%" style="text-align: center"> <a href="mailto:​‍‍{{Tenant ID}}​_task-manager_​‍{{Task ID}}​@eu.workflowcloud.com?subject=Re:{{Subject}}&body=Approve" style="width:80%; min-width: 70px; max-width:200px; border: 1px solid #28a745;border-radius: 4px;font-family: Helvetica, Arial, sans-serif;font-size: clamp(16px, 4vw, 20px); color: #fff;background-color:#28a745; text-decoration: none;font-weight:bold;display: inline-block;"><div style="margin: 15px 30px;">Approve</div></a> </td> </tr> </table>​

 

 

 

At first the placeholders will be plain text like this:

 

27062iD7291F05A8D63CE1.png

To replace them just highlight them, remove and hit insert.

 

For the Tenant ID this is the variable we created near the start

For the Task ID we can use Insert>Loop for each>Loop for each task instance>Current Item>ID

For the Subject select Insert>Loop for each> Loop for each task instance>Current Item>Subject

 

Be sure to replace all 6 placeholders, there are 3 for each button with 2 buttons in the code.

 

Next step is to configure the email as below.

 

The Assignee is selected by choosing Insert>Loop for each>Loop for each task assignment>Current item>Assignee

 

The Subject is the same as the subject placeholder above.

 

The outcome buttons are the variable stored using the build a text string action above.

 

Feel free to add any other messages before or after the buttons and configure anything else as you normally would in the task.

 

27063i59D6197B226A1070.png

 

Now our workflow is ready to test it should look like this:

 

27066iC64BF7D028201BCF.png

 

If you run your new workflow and put your email in the start form you will receive an email like this:

27068iCC8A0E43E77A9F2E.png

 

If you click on either Reject or Approve it will open a reply email for you with the message body pre-filled all you need to do is hit send. 

27071iF2D7CD620C7BCBB4.png

 

As we are only using standard supported HTML links, this method should work on any modern device/email browser, I cannot however guarantee the same look and feel for all devices with the buttons, for example on a Mac you may find the text inside the buttons turns blue.

 

Thank you so much reading along, I hope this blog was insightful and helpful to you.

 

Jake

 

Really hoping nintex provides buttons in the future automatically. We can't use express approvals due to sensitivity labels. Nintex cannot read the responses if we use the sensitivity labels accordingly due the content being shared on the email so very disappointing to have to use task forms on everything!!! 

Userlevel 4
Badge +14

@Jake Just FYI, the objects within NAC are acting up. Normally it opens on the last opened section, now there is a scrollbar you have to use vs it just automatically opening. Very annoying when you are trying to go 4 layers down the rabit hole!
 

 

Userlevel 4
Badge +14

What I noticed with this method is that security is no longer an option, anyone with the link can access the task. I assigned the task to my regular account and sent the email to my regular account and another account I use. 

Both accounts could access the form. :( That is NOT the behavior we wanted unfortunately. How do we resolve that? The individuals NOT a task assignee should not have access to the task form still, the same behavior the system should be looking at where they block non-task assignees from seeing the task if clicking the link. 

Userlevel 4
Badge +14

So I noticed both my accounts were listed as “global admin” in NAC. 

I changed one to “participant”. Now I have it working as expected with access denied to the non task assignees. 

 

Disregard previous post reply.

Badge +1

Can approvers add comments with the button approach or is it simply approve or reject with no comments?

Reply