I've a process that use some custom code to get the destination user.
(I call a web service to get the destination user)
My question is how can I stop the current activity if the webservcie return an empty user (if the webservice don't find a user, it return an empty string) and send an e-mail to the originator of the process to allow him to redirect the current activity to another user.
Thanks
1. Change the code behind the destination rule so that - if the web service returns an empty user, set the Originator as the Destination User.
2. In the SMTP Notification of the client event, I would build in some logic that - if the ActivityInstanceDestination.User.Name = Originator, send an email informing the originator to redirect the worklist item to an appropriate user. If the ActivityInstanceDestination.User <> Originator, send an email to the destination user informing him/her to action this worklist item.
I have not tested this but in principle it should work.
HTH,
Ockert
Hi Vinny,
What you can do is create a process level exception handler. Note that you can also create activity level exception handlers in the exact same way.
- Right click on the canvas and select properties.
- Select exceptions from the left and then click "Edit Code".
- Copy and past the following
public void Main (ExceptionContext K2)
{
ProcessInstance pi = K2.ProcessInstance;
object err = K2.ExceptionObject;
// check which type of exception and handle them specifically
switch(K2.ContextType)
{
case(ContextType.ClientEvent):
// handle client rule failure
break;
case(ContextType.DestinationRule):
// handle dest rule failure failed
break;
case (ContextType.ServerEvent):
// handle server event failure
break;
}
// regardless of which type send admin an email.
// Use System.Web.Mail and send an email.
}
please note that there are more ContextTypes than i've illustrated above. Use intellisense to see all of them. Also if you look in the help file you'll see another example of using the ExceptionContext class, search "ExceptionContext".
-mike
}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.