Search Results for

    Show / Hide Table of Contents

    Rule overview

    Casewhere is a rule-based system. Rules are used throughout the platform to drive business decisions — triggering processes, controlling workflow navigation, validating data, managing access control, and more. Rules are scripted in C# and have access to Casewhere APIs for interacting with data, users, and system objects.

    Rule types

    Rule type Purpose
    Access rule Controls user access to worker sites, pages, and widgets
    Scalar-function rule Reusable computing functions (e.g., default values, calculations)
    Workflow navigation rule Controls workflow activity inclusion, editability, and required logic
    Data trigger rule Determines when to trigger a workflow based on data changes
    Web trigger rule Validates web requests and determines when to trigger a workflow
    Data protection rule Defines anonymization logic for PII data to support GDPR compliance
    Security policy rule Enforces fine-grained security policies on pages, widgets, and widget actions

    Rule syntax

    Rules support two syntaxes.

    Expression syntax

    Use this syntax for simple, single-expression rules. The expression is evaluated and its result is returned automatically — no return statement is needed.

    @do.Status != "ReadyForSend"
    

    Function syntax

    Use this syntax for more complex rules that require multiple statements. Begin with the #predicate keyword and return the value explicitly.

    #predicate
     
    // Parse the request header
    var dataApi = @apiFactory.Get<IDataApi>();
    if (!@headers.ContainsKey("Authorization"))
    {
        return false;
    }
    
    // Query Api Keys in DB
    var headerKey = @headers["Authorization"].First();
    var filter = FilterBuilder.Create().Eq("ApiKey", headerKey).Eq("Active", true).Build();
    var found = dataApi.Any("Applications", filter);
     
    return found;
    
    In This Article
    Back to top Generated by DocFX