ECO Validation

Good day all.  I am trying to set up a validation (C#) for a field to make sure it is completed before moving to the next step in the Workflow Process.  I have seen some information for validating a checkbox in C# and some form of validation with VB (I don't know VB).  I can't seem to get this to work.  The coding I have tried either stop everything or don't stop anything.  I added the method to the Workflow Map Path as a Pre Method.  I would appreciate any help with identifying what I have missed.  Thank you.

Change Request - sm_DEMO_NDR (it is a testing ground for me)

Property - sm_change_end_state

Innovator inn = this.getInnovator();
Item controlledItem = this.apply("s_Get Controlled Item");
string is_completed = controlledItem.getProperty("sm_change_end_state");
if (is_completed =="") return inn.newError("Must be complete!");
return this;

Innovator inn = this.getInnovator();

// Set up the query Item.
Item qryItem = this.newItem("sm_DEMO_NDR","get");
qryItem.setAttribute("select","sm_change_end_state");
//qryItem.setID(endState);

if (qryItem = "") return inn.newError("Please select appropriate End State.");


return this;

Innovator inn = this.getInnovator();
Item endState = this.newItem("sm_DEMO_NDR","get");
string state = endState.getProperty("select","sm_change_end_state");
if (this.endState == "") {return inn.newError("Please select appropriate End State.");};
  • Seems like you have assigned an id to get a controlled item. This is my variant based on an original Aras sample:

    // Get the controlled item.
    Item controlledItem = this.newItem(this.getAttribute("type"), "labs_GetControlledItemCSharp");
    controlledItem.setID(this.getID());
    controlledItem = controlledItem.apply();
    if (controlledItem.getItemCount() != 1)
    {
    return inn.newError("Error retrieving the controlled item: " + controlledItem.getErrorDetail());
    }
    string teamId = controlledItem.getProperty("team_id","");

  • 0 オフライン in reply to AngelaIp

    Angelalp,

    Thank you for this.  I got it working.  I added the method to the Activity as a Server Event that activates On Vote.

    // Get the controlled item.
    Innovator inn = this.getInnovator();
    Item controlledItem = this.newItem(this.getAttribute("type"), "labs_GetControlledItemCSharp");
    controlledItem.setID(this.getID());
    controlledItem = controlledItem.apply();
    if (controlledItem.getItemCount() != 1)
    {
     return inn.newError("Error retrieving the controlled item: " + controlledItem.getErrorDetail());
    }

    //Get what is selected for sm_change_end_state
    string endState = controlledItem.getProperty("sm_change_end_state","");

    //If sm_change_end_state is empty, return the message.
    if (endState == "") return inn.newError("Please select appropriate End State.");

    return this;