Skip to main content
Hello, I need some help.

I have a workflow with a start activityfrom a user, a manager aproval and a super manager aproval. Everything goes well with a normal activity, but I need that the originator can cancel the work flow. How can I do that?
I try to send a activity to the originator and K2.ExpireActivity but it seems that only expires the working normal activity.
It is posible to kill a instance of the workflow?


thank
Alvaro
Add a new, boolean data item to the XML (call it UserCancel or something). Place a checkbox on a view of the form and tie it to this new item. Set up a line rule to the next valid activity if the check box remains unchecked (ex: UserCancel = False).

If the check box is not selected, the process goes to the next step. If the check box is selected, the process simply ends (because there are no line rules that match the case where the check box is checked (ex UserCancel = True). If you need to do cleanup activities when the user cancels the form (write to database, send e-mails, etc), simply add a line rule for the conditioin that the checkbox is checked and point it to your cleanup activity.

NOTE: This will work if you have a specific point in the process where you are giving the user an opportunity to cancel the form. A client event is added that displays the view of the form with the checkbox and the destintion rule is set to the Originator.

If you need the Originator to be able to cancel the form at any point in the process..... I'm afraid I can't help you there.
1.Well but in that case if the checkbox is not checked at that instance, the workflow will follow the normal process and cannot be killed by the initiator at any stage in the Workflow.
2. I would like the form to be assigned to an destination User to Approve as well as the Originator to Cancel. And completion of any one activity, should close the Workflow. IS IT POSSIBLE??
icon-quote.gifawwabk:
I would like the form to be assigned to an destination User to Approve as well as the Originator to Cancel. And completion of any one activity, should close the Workflow. IS IT POSSIBLE??


It is possible do what you described above, here's my suggestion:
  • Create your approval forms so that it's got 2 views, 1 for approver and 1 view for originator. You basically just show/hide applicable controls by checking (in the page load) if the person who opened the form = originator.
  • Add the originator and the applicable approver to each approval activity's destination list.
  • Now you have to allow K2 to create an activity slot for each destination (originator and approver). Do this by selecting the "
Create slot for each destination" radio button in the Activity properties dialog box.
  • Set the line rules needed, typically 1 where Status = Approved and 1 where Status = Declined. So if the originator canceled the item (Status = Canceled), none of the line rules will execute and the flow will stop as suggested by steven.hughes

Alternatively you could have a look at the K2Mng object. It has the functionality to stop process instances based on their Process ID's. But for this the users would have to be administrators on the K2 server instance, and that will create its own set of issues, so I would not recommend going this way.
HTH
Hi,

We came up with this solution (search on folio from SqlReader).



SourceCode.K2Mng.K2Manager mng=new SourceCode.K2Mng.K2Manager();

mng.Login("appbebr900",5252);

while(reader.Read())

{

foreach (SourceCode.K2Mng.ProcessInstance p in mng.GetProcessInstances(reader[ folio ]))

{

mng.GotoActivity(Convert.ToInt32(p.ID),"Activity Name");

}

}



We tested this in a rather simple process but it worked fine.

Greetz,

Remco
K2Workflow Benelux
I am using k2.net workflow and InfoPath,SharePoint for submitting a request for approval.
Scenerio. - Requester submits the request by filling up InfoPath form.
2. the request needs to be assigned to two users.
a. Approver for approval
b.Requester for cancellation.

If anyone of them reacts first the process complets.
If the Approver approves the request then the process is again assigned to originator in order to cancel the request after approval.

The problem which I am facing is as follow.
In the InfoPath Client activity I am selecting "Create slot for each destination user".
And storing the form at sharepoint with Delete Temporary field set.
SharePoint gets two files stored one for each destination.
Whenever any of the assigne user works on the form and submits the request, both temporary files are not getting deleted. Only one file which is assigned to other person ( the person who did not acted) get deleted.

Can anybody help me how should i delete both the temporary files?

Following is the workflow developed. Also the properties set for InfoPath Event.

Reply