Search Results for

    Show / Hide Table of Contents

    Data validation

    Before persisting data objects to DB, Casewhere will validate data against the configuration in the data class and the data attributes. If the validation fails, Casewhere will throw an error and reject the data.

    General validation

    Data conversion

    When persisting a data object, Casewhere will try to convert the data fields to the corresponding data attributes. If for some reasons the data conversion fails, Casewhere will throw an error and reject the data. Take the Application data class below as an example:

    image-20220617094447109

    If you try to run this script in a workflow,

    var dataApi = ctx.Use<IDataApi>(); 
    var id = dataApi.Add("CwUatTx2Application", new 
    {
        Budget = "test"
    });
    

    you will get an exception FormatException.

    Required

    All data attributes in Casewhere have a property named Required. If the property is set to true for a data attribute, a value must be specified for this attribute when Casewhere creates a new data object. Otherwise, it will throw an error and reject the data.

    Attribute-specific validation

    Enum

    Casewhere will reject all data persisting requests that attempt to set a value outside of the Enum predefined values.

    image-20220617100603471

    Foreign Key

    When the Enforce Constraint is turned on for a Foreign Key attribute, Casewhere will verify the data object reference. Casewhere will throw an error and reject the data if the referenced data object does not exist. This feature is available since v2.7.2.

    image-20220617101653054

    In This Article
    Back to top Generated by DocFX