Skip to main content

Hi,


We have an activity corresponding to the rejected status in the workflow. As we can go in this activity by following different way, we've put an expire event at the begining for expiring all pending activity.


In this Rejected activity, there's to Event :


1) The Expire Event :



public void Main(ServerEventContext K2)
{
 K2.Synchronous = true;
 if (Convert.ToBoolean(K2.ProcessInstance.DataFieldsd"GoTo"].Value) == false)
 {
  
  K2.ExpireActivity("Rejected  Status");
  K2.GotoActivity("Rejected  Status");
  K2.ProcessInstance.DataFieldsc"GoTo"].Value = true;
 }
}


2) An Email send.


The fact is, we receive the email two times. The ExpireActivity or GoToActivity don't seems to expire the Mail Event ?


How can I expire the current activity, so don't go on the next event ?


 Tanhks for your help

Instead of burying an 'IF' statement in a server event, why not control access to the activities via appropriate line rules, which is generally how these situations are handled.  This provides for visual reference to the process logic as well as easier, more visible maintenance.  Additionally, a GotoActivity() method will show down ALL open activity instances, thus if you have any parrallel tasks going on at the same time in this process, they will be shut down also.


Reply