Force closing a flexitask?


Badge +4

Is there a way to cancel the flexitask or force a specific outcome on a flexitask being executed based on responses from other users?

 

 

For instance:

 

I have an approval workflow that contains a set of parallel tasks that runs 5 separate approval processes in tandem. Each separate branch of the parallel action does different things based on each approver as they all have their own processes that must execute and set various items in separate lists based on what they responded with. (Its quite complicated to explain fully here)

 

That's the easy part, for the real complicated part:

 

There's a 6th branch in the parallel task that runs separately which notifies a person to execute the task being approved in the event that 4 of the 5 approvers say "approved". The tricky part is that all 5 approvers must actually agree but this allows us some flexibility in case someone is on vacation and that the majority of the approvers say "ok" that the approval process will kick off. If the process is already executed it kicks off a process that reverses the execution (that's the easy part); however, if the 5th approver comes back after the 6th process is started but has not yet been marked completed, and that approver says "Reject", I want to force the 6th flexitask to do one of the following:

 

Force an outcome of "incomplete" where it will then kick off the "incomplete" branch of the flexitask, this notifies the initiator that the process was not able to be completed (this is the ideal situation result if its possible) OR

Cancel completely and notify the user their action is no longer required (I can setup a notification manually if need be, but I don't want to end the workflow entirely because other processes are still in operation that need to finish)

 

Ideally I'd like to force the "incomplete" branch to kick off because it will allow the remaining part of the workflow to end normally which will notify the initiator that the workflow didn't finish completely but setting up a bunch of series actions to do that in each tree will make this workflow massive and I'm trying to avoid all that mess. I can setup separate workflow tasks that will do that if I have to, but ideally I'd just like it to finish normally so I don't have to go through all that manipulation of data and lists to get the proper result on each and every branch.

 

What I have at this point is basically along each of the reject trees in the flexitasks a forced "end workflow" which works ok, but sometimes it ends a little prematurely so I added a delay so other processes could still finish, but when I do that then there's still a chance the 6th flexitask can execute and complete during that "short window" delay which I'm trying to prevent. If I could stop that 6th flexitask by force ending it or cancelling it without having to end the entire workflow post-rejection of the 5th person, then I'm gold.


10 replies

Badge +4

So no one knows or is this not possible?

Badge +3

Hi,

If you are using standard 'Approval' tasks you can store the action ID into a variable, then use the 'Complete workflow task' action to complete a workflow task, but this doesn't seem to be possible with the flexi tasks, probably due to the custom outcomes they allow.

Maybe it might be possible to try and resolve the issue where you said 'sometimes it ends a little prematurely so I added a delay so other processes could still finish'. What other actions need to finish? Or is it separate workflows running you have to wait for? I guess you've probably already tried 'commit pending changes' rather than the delay? happy.png

Badge +4

Yes that's part of the problem. I use flexi tasks and they have custom outcomes on one of them (the others I have just approve, and reject with the option to capture "other" responses using lazy approvals). The arbitrary "complete task" isn't sufficient for these because when it completes, it needs to run separate task processes. Its quite a complicated series of events to explain on a simple forum post. I believe I outlined those well enough in the first post.

I just need to know how I can complete a custom flexi task. I can work out the rest of it but the flexi task and the associated parallel branches workflow tasks need to be stopped as well, those processes I can shut down with an end workflow task. I just need to know how to end the flexi task so the assignee can't get in there and make changes.

Badge +3

I don't think it's possible without writing a custom action. I tried using the Nintex web service and the 'ProcessFlexiTaskResponse'/'ProcessFlexiTaskResponse2' methods but it looks like these require the person making the web service call to complete the task to be the same person as the task assignee (which obviously won't be the case in the majority of scenarios). You can query the workflow tasks list for the IDs of the items you want to call the method on, so that's the easy part, but it appears that the web service will require the user and the assignee to be the same person so it's another non starter sad.png

Unless you have potential to write custom actions to do it, then you could override that or impersonate the right user perhaps. There seems to be another thread discussing it here: What is the ProcessFlexiTaskResponse web service suppossed to do?

In summary it doesn't appear to be possible with the OOTB actions.

Badge +11

I'm not sure I understand, but you could check a certain condition and based on that change the permissions for the assignee and anyone else using the 'Set Item Permissions' action. You could use a variable (number) that increases each time a person responds to their task and agrees. Use this for your 6th task.

Badge +4

I do have this already in the process. There is a counter that keeps track of approvals. Once the number reaches 3 it sends to the 5th approver, when it reaches 4 then it sends it on to the final approver (approver 6 actually executes the request, there's no approval technically). Its when the 4th approver comes back and rejects the process is where the whole system breaks down. After 4 of the total 5 approvers approves, the process can be executed by the 6th person, but if the final approver of the 5 total approvers rejects it, there must be some process in place to shut down the whole system and stop the 6th person from executing or being notified of it. This is where the force close of the flexi task process must kick off. There also needs to be a way that if the 2nd or 3rd approvers reject, that the other approvers are killed and notified their approval is not required. This can be done through an "end workflow" operation (this kills all flexi tasks in play as is), the problem is that I can end the workflow immediately but I cannot set a "rejection" or "cancelled" or "rejected by other approvers" status on those tasks so that its known they did not reject it. It just leaves it hanging.

It is a very complicated process, but its really irrelevant to the question. I just want to know how to close down the flexi task mid run. Don't get swallowed up in the details of what I'm trying to build. Nintex has a lot of functionality you wouldn't normally expect from workflows so I wanted to be sure I covered all my bases before I said "this can't be done with Nintex workflows this way."

If its not possible I'll find another route to create the process and/or modify the process so it doesn't get all tied up in other side tasks. The honest simple solution would be to make it an in-line approval process doing one person at a time instead of trying to all 4 at once initially and then bring in the 5th and 6th approvals mid run. We could force it to require all 5 approvers before going to the 6th, as well. This is possible, but I'm trying to mirror the process we have in place right now which is a more parallel process allowing for flexibility in who approves in what order. If its not possible then I can request the process be modified to accommodate the available technology or go with another technology that CAN do it the way we need to.

Badge +4

This is where I'm at as well. It doesn't seem possible.

Mainly I want to end these tasks so that their results show up for the reports, but it looks like this won't be possible. I want to force them to report as "incomplete" or "cancelled" or something that shows this person didn't actually do anything and also to force an email to be sent to them to not bother responding.

I CAN use an "end workflow" operation to stop all the flexi tasks, but it doesn't allow me to set a result which is what I'm looking to do. Maybe its not really an "end task" but changing a variable to show something else, then end the workflow which will kill the task after the result variable is changed? (I'm grasping at straws here)

Badge +3

I don't think it is possible sad.png I tried really hacking at it by using an 'UpdateListItems' web service call to directly update the workflow task to completed with a custom outcome, but if you do this with the same user whose task it is, you just end up with the rejected outcome, but worse still, similar to the requirements around the Nintex web service method 'ProcessFlexiTaskResponse' - if the task is assigned to someone else, you just get a error and the workflow errors, with a "Error in task. Unauthorized attempt to update workflow task by domainaccount. The response has not been recorded". It does set all the tasks to Not Required though wink.png but the workflow will be in an error state, so this is no use either.

I think the only approach is going to be to end the workflow to cancel the tasks, but you have no control over the outcome, but maybe start another workflow to handle what should happen next. It does seem odd there's no way to do this but that really does appear to be the case.

Badge +2

Is this still not possible?

Would really like to be able to achieve this.

Badge +4

Unfortunately I still haven't found a way to accomplish a force shut down of other approval tasks based off rejections from an approval tasks. I agree that this would be very beneficial.

Reply