I've changed my recommendation on this a little. Return the result of %ValidateObject() as the final argument, but don't return that status as the return value of the method. That way, if there are any required properties, and the call to %New() doesn't supply them, %OnNew() still works. Here's the updated example:
/// constructor
Method %OnNew(name As %String = "", phone As %String = "", dob as %Date, Output valid As %Status) As %Status [Private]
{
set valid = $$$OK
set ..Name = name
set ..Phone = phone
set ..DOB = dob
set valid = ..%ValidateObject() // validate the new object
return $$$OK
}- Log in to post comments