Mail Server Event not using Destination User of Acitivity

  • 4 January 2006
  • 8 replies
  • 3 views

Badge +3
I have both a client event and an email server event in the same activity that has an AD group as the Destination.

When the client event fires, everyone in the Destination gets the email generated from it - multiple users

When the subsequent email server event in the same activity fires it only sends email to me. It should also send to the same "Destination" I assume because I have clicked the radio button for "Destination User" for that Email Server Event. But it shows me the (person working on that worklist item in that activity) as the only recipient of the email event.

Why does the Destination User differ for these 2 events within the same activity? Why doesn't the email in the ServerEventContext use the same Destination as the ClientEventContext ?

Thanks,
Michelle

8 replies

Badge +8
Hi,

The reason for this behavior is because you have (I assume) only one destination slot defined for the activity. See explanation below on how this impacts your design.

K2 will create a work item for each of the destination users defined in your destination AD group. By default an activity is created with only one slot and this will ensure that users do not do "double work". I.e. as soon as 1 user opens the item, all available slots are occupied (only 1 slot remember) and the other destination users will not be allowed to work on this item. When the user eventually completes the item, the items for the other users expire, thus the other events created in the activity will only complete for the user who actually completed the client event. This is by design.

A possible workaround for your problem would be to create a new activity below the one in question, set the destination to be the same group as the previous activity and then move the email event to the new activity.

Alternatively you can build a string with the emails of all the users in the group and use that as the value for the destination field in the email template.
Badge +3
The scenario described seems to accurately reflect the conditions in my activity. I also appreciate your workaround suggestions. I had thought about the new activity below to send out emails but was hoping for an easy, one-liner solution.

Just out of curiousity, is it possible to reset the destination via code back to the original destination AD group before the email server event? I'd want to to use the AD group vs. plugging in user emails. Otherwise - no big deal. I'll probably go with the extra activity below suggestion.

Thanks!
Michelle
Badge +11
Hi Michelle,

If I understand your question correctly, the answer would be - No, it would not be possible to reset the destination back to the original AD group before the email server event. The reason for this is that at that specific time, an ActivityInstanceDestination object already exists for each Destination user and both Events are contained in each ActivityInstanceDestination object. Destination users on the other hand are part of the ActivityInstance object i.e. you're working with different objects at that point.

Hope this makes sense,
Ockert
Badge +3
Makes sense and thank you for the explanation.
Badge +13
With the new SP3 option for Single Activity for Queue, does the code still work?

In my destination I have an user assigned and a queue assigned, 1 slot.
An AD group is assigned to the queue.
In the client email event I want to filter out that individual user and just send email to the queue.

What would be in the K2.ActivityInstanceDestination.User.Email?
Badge +11
As far as I know, ONLY the single user's ActivityInstanceDestination.User object will be populated - exactly what you do not want since you don't want to send the mail to this user.
The ActivityInstanceDestination.User object for the Queue will be NULL because the implementation of "Create single Activity Instance for Queue" does not expose the user context until the participant takes ownership of the task.

Hope this makes sense,
Ockert
Badge +13
Problem:
Accessing this variable fails in server event: k2.ActivityInstanceDestination.User.Name

Scenerio:
I have a server event after the client event.
The client event is sent to a destination queue, which composes of AD groups, and single activity is checked. This is 1 slot.

Expectation:
When I completed the item as one of the AD group user, I expected k2.ActivityInstanceDestination.User.Name to be available (since I already took ownership of this item), but it seems this object is null?

I am using K2 2003 SP4.
Badge +11
This is a known issue in K2.net 2003 SP4. As a workaround, I would suggest saving the user fields you'll need further on to Activity datafields (in the Client Event).

Regards,
Ockert

Reply