Marking a Field as Optional or Required

In this example, the Description field is optional if the Request_Amount field is less than $1000.00. This example assumes that the Request_Amount field is numeric. If it is a string, it must be converted into a number before the comparison is made.

Example

For this example, the Description field must not be set as required in SBM Composer or overridden in SBM Application Administrator.

function RequestAmountChanged()
{
    var amount = GetFieldValue("REQUEST_AMOUNT");
    if (amount < 1000.00) {
        MakeFieldOptional("DESCRIPTION");
    }
    else {
        MakeFieldRequired("DESCRIPTION");
    }
}

AddChangeCallback("REQUEST_AMOUNT", RequestAmountChanged);