How to stop workflow in a specific case?

Hi expert, Would you help the case below? I created Workflow Map for ECO as below : Start -> Submit ECO -> Planning -> Make Changes -> Close Change When a creator of ECO try to do 'Submit ECO' in Workflow, additional logic needs to check whether revision of parts or documents attached in this ECO is 'VOID'(yes, we set revision of a document or a part with 'VOID' for special case) and if there is 'VOID' case, the logic needs to stop workflow by giving warning message to user which is that "You can't do a vote because revision of a document or a part attached is VOID". So, I opened 'Workflow Map' of ECO in administration and click "Submit ECO" point and click "Server Events". I created JavaScript method with 'On Vote' Event. The question is that after I show alert message to users, how I can stop the workflow? Would you help on this? Thank you.
  • Hi Joseph, You can prevent a workflow vote using a server-side Pre Method on a workflow transition. Here are the basic steps:
    1. Open the workflow map for editing.
    2. Click on the transition (arrow) that you want to attach your method to.
    3. In the tabs at the bottom of the window, select Pre Methods.
      • These methods will execute before the user's vote succeeds. If you return an error from a Pre Method, the vote will fail and the error will be displayed to the user.
    4. Add a CSharp method to the Pre Methods tab.
    5. In the method, check your business logic. If the vote should not succeed, you can use the following code to prevent the vote:
    Innovator inn = this.getInnovator();
    return inn.newError("Error message to display to the user");
    Hope this helps! If you have trouble getting the workflow's item (ex: the ECO), you can use the GetChangeControlledItem method that is included in some of our workflow-related community projects. Eli
    Eli Donahue Aras Labs Software Engineer