Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Jas

Senior Veteran
Registered:
Posts: 429
Reply with quote  #1 
Hey Guys

I need to do some form validation but on when action completed to allow the form submit to write data to a table.

I have a try and catch as follows -


try
{
  if(data.chkNonInvForGlobal)

  {

    if (Mstm.SelectSql(null,"SELECT blah") == "blah")

      {

            ProcessContext.UserError = "blah blah";

       }
  }

}
catch(Exception ex)

{

Mstm.WriteToLog("Validation Error: " + ex.Message, ex.Message, Severity.Error);

}


What I find is that I have to use severity.error in the catch block in order for the error in UserError to display. However doing so stops the form from subsequently being able to submit / cancel if the user changes the field options on the form?

0
BMellert

Guru
Registered:
Posts: 688
Reply with quote  #2 
I guess the first question is what would you like it to do?  Severity.Error does stop all processing, and log it to the table, as does setting UserError.

Presuming you'd like some sort of pop-up / alert message, which would allow the user to go back and fix said issues, you will need to create a client "on form submission" script to validate (can be done via getField as appropriate) and display an alert or confirm message, returning false if validation fails (presuming you want to the user to go back and fix the issue) or true otherwise.  For example:

 

if (getField("InquiriesMade",null) == "false")

{ // no conflict review options chosen

     alert("Check all applicable paragraphs indicating the status of the conflict clearance.\r\nYou must select at least one.");

   returnfalse;

} // No conflict review options chosen (if)

elseif (getField("chkAMLVerify",null) == "true")

{ // AML not "verified"

     alert("You must set forth the identification and verification efforts that were undertaken.");

   returnfalse;

} // AML not verified (else if)

else

   returntrue;

}

else

   return true;

 

0
gfield

Avatar / Picture

Senior Member
Registered:
Posts: 61
Reply with quote  #3 
The UserError use the Throw Error to stop processing and report the error. It even creates a status 2 entry in the Error log.

So complete your validation outside the Try Catch setting the ProccessContext.UserError to 'blah blah' which will stop processing the code at that point.

Once you have validated the Content, then run your moving forward code inside a try--catch if you wish.  


__________________
Cheers Graham Field
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!