Solved

How do I capture the Workflow Task ID

  • 3 September 2017
  • 16 replies
  • 509 views

Badge +9

I have an assign flexi task within a workflow.  I would like to capture the Workflow Task ID to use in the flexi task reminder email but I am unable to find the WF Task ID available as a variable ?  Any suggestions ?

icon

Best answer by emha 5 September 2017, 08:47

View original

16 replies

Userlevel 5
Badge +14

flexi task's TaskID is only populated after the task is responded (unlike other task actions).

Badge +9

Is there any possible way to send the user to the flexi task form then. I noticed before I turned off the email notifications that when the user receives the email about being assigned the Flexi task - there does appear to be a link within the email which when the user clicks con takes them to the assign Flexi task form where they can then accept or reject the task.

In short I just need the link that gets them to the form.

I had to turn off the email notification as the group was happy that 10 people get assigned the task, but they want the notification email to be sent to a shared mailbox.

Userlevel 5
Badge +14

 There's ApprovalURL common reference variable  for that purpose.

But it is available just within the scopeof flexible task.

Do you want to send notification  on your own out of task scope?

Badge +9

Correct.  I would like to keep the Flexi Task for assignment purposes, but an email notification would be done outside of the Flexi task.

Userlevel 5
Badge +14

then you'll have to build logic like this

you need to use parallel action.

in one branch you assign the task. in one of task's fields (task name, task description...) you will have to define your own unique task identifier.

in other branch, first let it wait for short period of time so that task is created and settled.

then query workflow task list and search for a task by your custom task identifier. let the query return (task) ID field.

then you can use the ID in mail notification to build approval link

flexi‌ flexi task‌ id‌ flexi task id‌ parallel‌ task list‌ query task list‌

Badge +9

So am I defining  the unique ID within the actual list or the list called Workflow tasks.  I assume you are indicating that I should create a unique id within the actual list and not the list called Workflow Tasks.  If that is true then

1-how does that allow me to build a URL that will open the FlexiTask approval form ?  The only way it appears that I can open the approval form is I get the ID found within the list called Workflow Tasks

2-how would I define the unique task identifier - the list itself already has the List ID - wouldn't that be a way of defining the unique identifier...

I think I am not following so hopefully you can fill in the missing piece for me...thx for your patience

Userlevel 5
Badge +14

no, this is not going to be a field in any list, it's not needed.

it's just a workflow variable which you populate with some identifier (string) that uniquely identifies given task.

the point is that nintex unfortunately doesn't provide a way how could you determine a task created by flexi task action until the task is responded.

in order you could determine the task you have to directly approach (query) task list. and to find the task within task list you need to setup some search criteria. unfortunately again, nintex is not helpful in this regard either.

that's why you have build your own custom unique task identifier. so this just to identify proper item in workflow task list, to get ordinary task ID. you do not use that custom identifier directly in approval link.

if I'm forced to do something like this, I use to build identifier as follows

<Workflow Title>_<Workflow instance ID>_<Item ID>_<Current DateTime>_<TaskNameOrIdentifier>

workflow title and workflow instance ID uniquely identify given workflow instance (instance ID would be enough, but I and title to immediately spot to which workflow it is related to)

item ID identifies on which list item the workflows runs on

Current DateTime helps to distinguish among tasks generated by the same flexi task action within the same workflow instance, if the action is executed several times.

TaskNameOrIdentifer distinguishes among several flexi tasks withi the same workflow

in runtime the identifier might look like

NewApprovalWorkflow_05a411c7-56af-404a-a927-266abf536caa_99_2017-09-06T09:47:35_ApprovalStep3

I store the identifier in a workflow variable and use it  later in flexi task action to "flag" it

and in query list action in other parallel branch to get ordinary task ID by my custom identifier

then you would use variable WorkflowTaskID to build approval URL

Badge +9

Brilliant

Userlevel 5
Badge +14

Badge +3

Hi Guys/Gals,

Just a heads up!

Be careful when designing workflows in an  "Parallel Control" there are places that it is required and works.

However when assigning a task / approval to the one side of the parallel task it can/may cause the workflow to go into an locked state.. Then requiring you to run an PowerShell command to release it and manual interaction get it to flow again..

This happened when I migrated from Nintex 2013 to Nintex 2016. So if you are planning to migrate to a new nintex version it is possible that you will experience the same issue.

It has come to my attention that Nintex 2013 is much more forgiving in poor nintex workflow designs than Nintex 2016.

This happen to me and spent a whole 2 weeks resolving workflows with parallel controls.

I would recommend that if you need the task to be completed for the parallel action to take place rather build you separate workflows that use the IF control.

If you are not sure how to do this I am willing to assist you.

PS - Not sure if you know but the Flexi task has an "Reminder  Control" Built into it. I would recommend you should try using that before you move over to the parallel control.

Kind Regards

Userlevel 5
Badge +14

interesting finding...

have you identified what caused the lock?

have you had scenario like depicted above with single task, or have you had a task in several/each parallel branch?

did this happened (just) for workflows that were running over transition period, or did this happened for new workflow instances on 2016?

Badge +3

It was pretty much exactly the way you created yours above.
However my lock occurred with the "Approval Control".  See Demo Image below...

When I removed the parallel control and implemented the "Flexi Task Control" this resolved all Workflow locks.

I would not recommend the above implementation. However I like to create multiple workflows for each specific task I would like carried out. Then use the "Start workflow Control" and initiate it when I need it to start.  

Badge +3

Oh and this happened to all transition and new workflows that was running.

Badge +9

The reminder controls though get sent out to the assignees which I am trying to avoid.  I need reminders to go to a Shared Mailbox.  Thus I turnred off emails within Flexi Task and used Marian H's method via parallel.

Badge +2

@emha Thank you for this brilliant solution. I have the same requirement as mentioned by @davidjohnson500 


I created a test workflow by following the steps you posted. For some reason, I am not able to retrieve the Workflow Task ID in the 'Query list' action. I have an integer variable in which I am storing this ID, but it defaults to 0. Everything else works fine. Could you please help me this? Thanks in advanced!


 

You can get Task ID by Query List:


Query "get the last task (first ordered task) by Workflow Instance ID".

Reply