Dynamic Workflow voting

I am using the following peice of code for dynamic voting of workflow : 


StringBuilder voteXml = new StringBuilder("");
voteXml.Append("<Item type=\"Activity\" action=\"EvaluateActivity\">");
voteXml.Append(" <Activity>{0}</Activity>");
voteXml.Append(" <ActivityAssignment>{1}</ActivityAssignment>");
voteXml.Append(" <Paths>");
voteXml.Append(" <Path id=\"{2}\">{3}</Path>");
voteXml.Append(" </Paths>");
voteXml.Append(" <DelegateTo>0</DelegateTo>");
voteXml.Append(" <Tasks />");
voteXml.Append(" <Variables />");
voteXml.Append(" <Authentication mode=\"\" />");
voteXml.Append(" <Comments>{4}</Comments>");
voteXml.Append(" <Complete>1</Complete>");
voteXml.Append("</Item>");

Item result = inno.newItem();
result.loadAML(String.Format(voteXml.ToString(), arrActivity[i], arrActivityAssignment[i], Path, Paths, "Done"));
result = result.apply();

However there are some validations on the pre transition method of an activity, as long as the validation passes the method runs fine. However in case of an error message , the respective workflow activity is getting closed (it is supposed to remain active).

Could someone please let me know why this is happening.

Thanks.

  • Hi

    Pre transition events are associated with life cycle of an item type and voting are associated with Workflow of an item type.

    1. Check whether the method is triggered before the workflow sign off activity.

    2. Check whether the life cycle transition is happening before sign off or after sign off.

    I suspect, there is a Promotion attached to an activity in workflow and the method is triggering during that promotion.

    Example: 

    Life Cycle : Start --> In Progress --> Closed

    Workflow : New --> In Review --> Closed

    Assume

    Added Pre Transition event in Start state in life cycle

    Added Promotion in In Review activity (Life cycle state change from Start --> In Progress)

    On Sign Off from New to In Review, 

    First sign off will happen, then on complete of this sign off activity, will trigger the life cycle promotion from Start to In Progress

    So, Pre Transition method is added on start of this promotion so it will throw error.

    Let me know if it helps.

    Thanks

    Gopikrishnan R

  • Hi Gopi,

    In this particular case there is no life cycle transition involved and and the method is a pre-event of our workflow transition path....However I noticed that this seems to be an issue with the error handling piece of code. 

    Method to vote - > calls the pre-transition method on apply.

    pre-transition method returns validation error message( inno.newError(...some text...) ) to our method.

    In our method try clause fails and exception message is send back as Aras.server.core.innovator Server exception and the workflow activity automatically is send to closed state from Active.

    I am not sure how to resolve this issue. 

    Hope this is clear.

    Thanks.