cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can only get the TaskId when the task is done

Jump to solution

I have parallel actions where on the left branch is the Request Approval task and on right branch is the Store Data action in which I'm trying to store the task id using the variable TaskID. 

 

The problem I'm having is that TaskID is only populated when the approval task is done. I think it should be possible to get hold of the task id as soon as the task item is created. I wanted to pass the task id to another workflow so I can query it when the task is not yet completed. How can I do this?

 

It's also happening with Request Review task action. I haven't tested it with other task actions.

Labels: (1)
Reply
6 Replies
Workflow Hero

Re: Can only get the TaskId when the task is done

Jump to solution

put a Loop action before the Store Data action. Set the looping condition to loop while the TaskID variable you created is empty. Once the task ID is stored in the variable in the other branch, the loop will stop and the task ID can be stored using the store data action.

0 Kudos
Reply
Not applicable

Re: Can only get the TaskId when the task is done

Jump to solution

I want to capture the Task ID before the task is done. The TaskID is only populated after the task is completed which is too late. A loop will not be able to capture it until the task is done.

0 Kudos
Reply
Workflow Hero

Re: Can only get the TaskId when the task is done

Jump to solution

ah, i see, sorry, didn't realise the ID is only stored after the approval.

can you use the task name to get the ID of the task by using a query list action on the workflow task list? obviously that will only work if the task name is unique.

0 Kudos
Reply
Not applicable

Re: Can only get the TaskId when the task is done

Jump to solution

Hi Patrick, I can't guarantee the task name to be unique.

0 Kudos
Reply
Workflow Hero

Re: Can only get the TaskId when the task is done

Jump to solution

in that case the only workaround I can see is, that you query the workflow task list by filtering using the Related Content column in the workflow task list. That contains the item URL. You might have to apply some additional filtering based on other columns if the item URL is not enough. Something like the status, assigned to or creation date. That will do the trick.

0 Kudos
Reply
Workflow Hero

Re: Can only get the TaskId when the task is done

Jump to solution

Using a parallel branch and running a query in a loop while the task is pending can help you achieve the desired outcome. Check out my post here:  

Reply