Search Results for

    Show / Hide Table of Contents

    Attribute default value

    This feature is available in version 2.7.2 or later

    Object creation, in many cases, is complex. Generally, repeating the object creation logic in different workflow definitions is not a good practice because we might forget to update this logic when it changes. Casewhere allows configuring object creation logic by specifying rules for setting default values for data attributes.

    Configuration

    Casewhere uses scalar-function rules to calculate default values. In the data class editor, select the data attribute you want to configure default value, then select a rule or writing a new one.

    image-20220629221748554

    Please note that if you specify a value for the attribute when creating a new object, Casewhere will persist this value and ignore the rule. In the below example, the created message will have status Sent instead of the default value Draft.

    var dataApi = ctx.Use<IDataApi>(); 
    dataApi.Add("CwUatTx2Message", new 
    { 
        Status = "Sent", 
        Content = $"Application {ctx.Input.Name} is {ctx.Input.Status}" 
    });
    
    In This Article
    Back to top Generated by DocFX