Make the ECR "Product" field required/mandatory when user selects to promote the ECR from the state of "New" to one of two possible states (only this life cycle path).

I need help with a C# script that will make the ECR "Product" field required (mandatory) when the user selects to promote the ECR from the state of "New" to one of two possible next states (life cycle has two different paths to select from).

Help is very much appreciated!

-Don

Parents
  • I was able to create the following C# script that seems to work well and no syntax errors however i am new to C#. Can someone look at my script to see if i have it designed correctly? This is on the Pre-event of a life cycle transition.

    String product = this.getProperty("product", "");

    if(product == "")
    {
      return this.getInnovator().newError(String.Format("The 'Product' field is required.", this.getProperty("keyed_name", "")));
    }

    String change_description = this.getProperty("change_description", "");

    if(change_description == "")
    {
      return this.getInnovator().newError(String.Format("The 'Changes Requested' field is required.", this.getProperty("keyed_name", "")));
    }

    String change_reason = this.getProperty("change_reason", "");

    if(change_reason == "")
    {
      return this.getInnovator().newError(String.Format("The 'Reason for Changes(s)' field is required.", this.getProperty("keyed_name", "")));
    }

    String req_comp_date = this.getProperty("req_comp_date", "");

    if(req_comp_date == "")
    {
      return this.getInnovator().newError(String.Format("The 'Requested Completion Date' field is required.", this.getProperty("keyed_name", "")));
    }

    return this;

Reply
  • I was able to create the following C# script that seems to work well and no syntax errors however i am new to C#. Can someone look at my script to see if i have it designed correctly? This is on the Pre-event of a life cycle transition.

    String product = this.getProperty("product", "");

    if(product == "")
    {
      return this.getInnovator().newError(String.Format("The 'Product' field is required.", this.getProperty("keyed_name", "")));
    }

    String change_description = this.getProperty("change_description", "");

    if(change_description == "")
    {
      return this.getInnovator().newError(String.Format("The 'Changes Requested' field is required.", this.getProperty("keyed_name", "")));
    }

    String change_reason = this.getProperty("change_reason", "");

    if(change_reason == "")
    {
      return this.getInnovator().newError(String.Format("The 'Reason for Changes(s)' field is required.", this.getProperty("keyed_name", "")));
    }

    String req_comp_date = this.getProperty("req_comp_date", "");

    if(req_comp_date == "")
    {
      return this.getInnovator().newError(String.Format("The 'Requested Completion Date' field is required.", this.getProperty("keyed_name", "")));
    }

    return this;

Children
No Data