Skip to main content
Hi all,

I need to release automatically open activities after a timeout, but I really don't now how to do that.

In fact, users sometimes open an activity but don't complete it, and forgot to release it, so the activity is block for other users. Can the activity be automatically released with a timeout?

Thanks for your help.

Aude
Hi,

I've read a solution on the forum : an Goto escalation.
But my problem is that I want to escaladate 5 minutes after the form opened. So I save the time in a datafield when I open my form. The problem is when the escalation fire, this datafield isn't filled ... Is there any chance to have a dynamic escalation ?

Thanks a lot,

Aude
I'll have to think about this, but what should happen with the current Client Event after the 5 minutes?

Ockert
nothing, the activity should return in is initial state. In fact, it's just because sometimes users forget to release activities they don't want to complete, so other users can not complete it. So we just want to re-availlable activities open for x minutes.

Thanks for your help.

Aude
I don't like this because it will put unnecessary load on the K2Server but you can define an Escalation to be repeated every minute for say 100 times. In your UI page, you set an 'EventStart' process level datafield to the time the user opened the item - Process level variable because I don't think you can get to ActivityInstanceDestination datafields from the Escalation Action code. In the Escalation Action code, you check whether the current Time is 5 minutes or more after 'EventStart' process datafield. If it is, you expire the Activity and with a recurring line which is ONLY followed when the Activity is expired, re-instantiate the exact same Activity. All user input will obviously be lost and the user will have to re-enter everything from scratch.

Messy!!

Ockert
PS! Recurring lines have caused many headaches in the past - so, handle with care.
I think almost any solution to this problem may be messy but here's another option.

When you want an activity that needs to return to the pile as it were like this, you could have a precursor activity that sets up an escalation for the real activity. In more detail...

Say you have an activity "Activity Z" that must escalate X minutes after the form is opened. You could set an escalation rule on Activity Z that uses a datafield "Z timeout" to set the timeout X. That activity contains a client event with a form url in it.

In studio, create a second activity "Activity pre-Z" and place in it a client event that points to a url of a precursor page. The escalation rule on "Activity Z" should goto this new "Activity pre-Z".

In that page, place code to do the following when the form is opened:

  • Retrieve the process instance.
    Set the datafield "Z timeout" to your desired amount.
    Finish the worklist item synchronously. (This will ensure that K2 has processed everything we need ready for the next step.)
    Open the users current worklist, filtering for the current folio, and activity name "Activity Z".
    Find the worklist item that is part of Activity Z and retrieve the URL for the client event.
    Redirect your form to the client event.


This will mean that your pre-z form will set up an escalation for the real form and open it at the same time. This get's around the fact that escalation's must be set before the events in a activity are processed.

If I haven't explained that well enough please let me know.

Thanks.

Adam.
I might be missing the point entirely ... but maybe approach the solution differently.

How Frequently do users not release items they have opened?

If it is a more prevalent behaviour the best option may be to open the Worklist item without automatically allocating it to the user (from K2ROM OpenWorklistItem(SerialNumber, False))

Then rather let users confirm that they are taking resposibility for the worklist item - at which point you can allocate the Worklist Item.

Lori

Reply