api:validate

Version 23.0.9145


api:validate


Use the api:validate keyword to throw an error if a mandatory value is not provided.

Parameters

  • item: The item that contains the attribute to validate.
  • attr: The attribute to validate. If the attribute does not exist, an error is thrown.
  • code: The error code to throw if validation fails. Default: api:validate.
  • desc: The error description to throw if validation fails. By default a message is thrown that the specified attribute is required.

Example

Throw a specific message if the _query item does not contain the Id attribute:

<api:validate attr="_query.Id"   desc="The Id is required to delete."/>

See Also

  • api:throw: Raise an error (exception) from within a script.