dynamic-crud-validator
Service icon

DynaMic CRUD Validator

Stable version 1.0.1 (Compatible with OutSystems 11)
Uploaded
 on 3 Nov
 by 
0.0
 (0 ratings)
dynamic-crud-validator

DynaMic CRUD Validator

Documentation
1.0.1

Dynamic CRUD Validator is an OutSystems component designed to automate data validation for CRUD operations. It dynamically creates validation rules based on the structure of database entities, saving time and improving data integrity. Below is a detailed guide to installing, configuring, and using this component.

INSTALLATION

Download and Install the Component:

  1. Go to the OutSystems Forge and download the Dynamic CRUD Validator component.
  2. In your OutSystems environment, open Service Studio, navigate to the "Manage Dependencies" section, and add DynamicCRUDValidator to your application.

IMPLEMENTATION

Using Dynamic CRUD Validator in Your Application:

  • Place the Dynamic CRUD Validator component in your logic flow where CRUD operations are performed.
  • This component automatically retrieves metadata for the target entity and applies relevant validation checks based on conditions such as:
    • Required fields (mandatory attributes)
    • Text length constraints


Configure the Validation Flow:

  • Create a Server Action:
    • Start by creating a server action where you'll integrate Dynamic CRUD Validator before performing your actual CRUD action (Create, Update).
  • Convert Record to JSON:
    • Convert the record you want to validate into JSON format. This allows the component to process the data more flexibly and enables easy parsing of attributes.

  • Provide a list of attribute names not included in the validation if needed.

  • Provide the rest of the parameters.

PUBLIC SERVER ACTION

Below is an overview of the main public methods provided by Dynamic CRUD Validator, including their parameters and return types:

Validate

  • Parameters:
    • SourceDataJSON (Text): The data to be validated, provided as a JSON string for flexibility and ease of parsing.
    • ExcemptedAttributeNames (List<Text>): Optional. A list of attribute names to exclude from validation, allowing specific fields to bypass checks as needed.
    • ESpaceName (Text): Optional. The module (eSpace) where the target entity is defined; not required for external entities.
    • EntityName (Text): The name of the entity to be validated, enabling precise mapping to the entity structure.
    • IsCheckMandatory (Boolean): Optional. Enables or disables validation of mandatory fields.
    • IsExternal (Boolean): Optional. Set to True if the entity is located in an external database.
    • LogicalDatabaseName (Text): Optional. Used to specify the logical database name when IsExternal is True, helping to narrow down the search for the entity.
  • Return: 
    • Result (Structure): A structure that includes detailed fields for validation status and error messages, providing clear feedback on any validation issues encountered.
  • Description: Dynamically checks the provided data against the entity’s defined structure and rules, leveraging metadata from Entity and Entity_Attr. It verifies each field's data type, length constraints, and—if enabled—mandatory status, aligning the record with the entity’s integrity requirements. This action provides a streamlined, automated approach to data validation, helping developers maintain data consistency and prevent invalid data entry with minimal manual effort.