Client event and server event in same activity


Badge +1

Experts,

 

Is it is a best approach to keep client event and server event in one activity?

If no, what would be the reason?

 

Regards

LK


2 replies

Badge +15

I don't see anything wrong with it as long as you felt the client event and server event both add together to fulfill a larger activity. I believe it's more of a design choice. For instance, SmartObject events do not require user interaction as well, and I have seen many people (including me) group them together wtih client events under a single activity.

Userlevel 1
Badge +8

That is a very situational question and will depend on your requirements and also as long as you are taking into consideration how an activity executes.

 

To my first point, there isn't any technical reason why you cannot put a server event in with a client event. Just always keep in mind that all events in an activity are executed in linear order from top to bottom. Workflow execution stops and waits at a client event, so you will need to take a look at when you need the server event to fire as you may want to ensure it is before the client event depending on the need. Also, if the server event may need to be optional based on something that occurs during the client event, then it would need to be in a separate activity since all events in an activity fire.

 

Having said all that, there are two caveats that many people don't realize and you will need to keep in mind. The first is that all events don't ALWAYS fire in an activity. If you have an activity with a client event and there is an escalation on the activity that expires the activity after a period of time, the events after the client event will not fire.

 

Another behavior that you need to take into consideration is that if you combine a client event and a server event in the same activity, you need to pay attention to how the destination is planned. If you use a plan per slot or plan per destination option,  then imagine that as multiple copies of the activity (and all of its events) one for each slot or destination depending on the plan method chosen. If your expectation was that the server event would only fire once regardless of planning options, then it would need to be broken out into another activity. 

 

Finally, a small nuance to activity event execution in those plan per slot and plan per destination scenarios is that many tend to think of it as executing all events in each activity before moving to the next activity. So activity 1 and then events 1 2 and 3, then activity 2 and then event 1 2 and 3. Reality is that is is more like Activity 1 Event 1, Activity 2 Event 1, Activity 1 Event 2, Activity 2 Event 2 etc..etc.. Think of it as more of a left to right moving down through the events like a typewriter going to a new line after a carriage return.

 

So yes, while you can under most circumstances put a sever event into the same activity as a client event you will need to keep in mind other scenarios that can bring you unintended/unexpected results if you aren't aware of how things work.

 

Hope this helps.

 

S.

Reply