Dear all,
Our workflow have such scenarios that we get destinations using Smartobject interface, sometimes this interface get no destination, if such things happens, this activity will marked as "approved" and step to the next action.
I have tried to use Default Server Event with such code:
public void Main(Project_ae1cc532a7e440c8bde40460075f2375.EventItemContext_a0c29afc7f70413d9cd25cfd60bf4816 K2)
{
string defaultActivityParticipants = K2.ProcessInstance.DataFieldse"_DEFAULT_ACTIVITY_PARTICIPANTS"].Value.ToString();
if (K2.ActivityInstanceDestination.Destinations.Count == 0
|| (K2.ActivityInstanceDestination.Destinationsi0].Type == DestinationType.User
&& K2.ActivityInstanceDestination.Destinationsi0].Name == defaultActivityParticipants))
{
K2.ActivityInstanceDestination.ActivityInstance.DataFieldse"Outcome"].Value = "Approve";
K2.ExpireActivity(K2.ActivityInstanceDestination.Activity.Name);
}
}
These code should be work but when we test it, the status of this activity is "Empty" and the process get into "Error" status, the log we got is "An Activity with a client event should at least have one destination".
Can anyone help us to implement if there is no destination, the this activity should be skip as "Approved".
Many thanks