User Task customization in K2 using Worklist

  • 24 July 2017
  • 9 replies
  • 10 views

Badge +5

Team,

I am a SharePoint developer with K2 Tool.I am using User Task (SmartForm) for the approval process(Approval / Reject). Moreover, i am using Worklist to show the tasks assigned to the current user.The user can also able to cancel the request (Cancel Request button in SharePoint Item View not in K2 User Task). The Problem is what if Request is already canceled by Requestor itself. Still, it's showing in K2 WorkList. If Request is canceled by Requestor it should not show to Approver Worklist. While Worklist filtering I cannot able to filter the worklist items based on SharePoint column status. Is there any other way to achieve this?

 

Thanks


15094iB173B5609771B04C.png


9 replies

Badge +8

K2A,

You need to end the workflow when the cancel button is selected. If that is the end of the process then the cancel button can move to a non task in the workflow. I usually send it to an email or something. This will end the workflow and it will not longer show up in your worklist. I hope this helps.

 

Thanks,

Bryan Peters

Badge +5

Hi BryanPeters,

 

Thanks for your reply. But how can i end the workflow on button click? (cancel button click). The main approval workflow will start on Itemcreation only.

I want to end the Approval workflow particular instance .

 

Thanks,

Gokulnath

Badge +8

K2A,

 Usually what I do is add multiple buttons to a form. One of them is a cancel button. In the workflow for the task that is going to be canceled I add an outcome. The outcome can say end workflow or canceled. Usually in most cases that outcome goes to an email to let the originator know the task has been canceled. But, it can go to a placeholder called canceled. Then in the form I have a rule that says when the cancel button is clicked action the workflow task with the canceled action. It calls that task and actions it for the canceled outcome. This ends the workflow.

 

Generally if a workflow is pending some sort of action like a user task the workflow will not end until the final task is completed. But, if the outcome leads to a non task in the workflow the workflow will end because there are no pending tasks and there is no place left for the workflow to go. Below is an example of one of my workflows.

 

 

If you notice each task has two outcomes in this particular workflow. It can either be approved or rejected. If it rejected the workflow goes to an email and ends. If approved it will move on to the next step. Now the step that ends the workflow does not have to be an email. It just has to be another step that does not require a task. This could be a placeholder if you do not want to send an email. There might be other ways to end the workflow but to me this is the easiest. The workflow will no longer show up in the worklist because it is not pending a task so therefore the workflow has ended.

 

I hope this helps. If you need to see an example of the rules let me know. I will be happy to screenshot them for you and add then tot he thread.

 

Thanks,

 

Bryan Peters

Badge +8

Here is an example of the rule I use to action the worklist item.

 

 

Thanks,

Bryan Peters

Badge +5

Hi ,

i didn't get your screen shot. Could you please send me again.

 

Then is there any way to update K2 Workflow status column, Which is used in Worklist item filtering.?

 

PFA

Thanks,


Userlevel 3
Badge +9

If I understand correctly, below is your requirement. Please confirm.

1. The originator should be able to cancel the request whenever he/she wants after submitting the workflow.

2. You do not want to assign a task to the originator and should be canceled on click of cancel button from SharePoint form.

3.  Workflow has to be completed as the originator clicks on cancel and tasks to the approval should disappear from their work list.

 

 

Badge +5

Hi 

 

 

 

 



Badge +5

Any solutions Please suggest Team,

thanks,

Gokulnath

 

Userlevel 3
Badge +9

Hello K2k,

 

There are 3 ways to achieve this first 2 are not straight forward. Basic idea is to compete the workflow which will expire the tasks assigned to all approvers.

 

  1. You can use async server event, https://help.k2.com/kb000272  . On cancel button finish the server event and complete the workflow.
  2. You can use workflow management service broker.

http://community.k2.com/t5/K2-blackpearl/WorkflowManagement-Service/ba-p/65416

On click of cancel button call go to activity method on smartobject and send workflow to workflow end activity.

 

3. This is easy one but you will need to assign task to originator parallel with other approver. On cancel button click, use 'Open worklist item' and 'Action a worklist item' actions in smartform sequentially. As soon as originator completes the task, workflow will move to workflow end activity. In this case, only originator can cancel the request as task is assigned to originator only. You could apply filter in worklist to not to show tasks with activity name 'Cancel Request' where the task is assigned to originator. This way originator would not see task in worklist.

Let me if this helps.

 

 

Reply