Class CaseAvailableFunction
Determines whether a case is available for input (default: true).
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CaseAvailableFunction : CaseFunction, IDisposable
Remarks
This function runs before the case input form is shown. Returning false hides the
case entirely from the user. Returning true or null makes the case visible.
Typical uses:
- Role-based visibility: show a case only to employees with a specific attribute.
- Condition-based visibility: show a case only if a prerequisite case value exists.
- Period-based visibility: restrict input to specific months or cycle phases.
Low-Code / No-Code: Case availability can also be controlled through
action expressions using CaseAvailableAction attributes — no C# scripting required.
The IsAvailable() entry point invokes all registered actions before executing
any inline script body.
Examples
// Available only for employees with level 2 or higher
(int)Employee["Level"] >= 2
// Available only if the Wage case value exists in the current period
HasCaseValue("Wage")
// Combine both: require Wage value AND minimum level
HasCaseValue("Wage") ? (int)Employee["Level"] >= 2 : false
Constructors
View SourceCaseAvailableFunction(object)
Initializes a new instance with the function runtime
Declaration
public CaseAvailableFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
CaseAvailableFunction(string)
New function instance without runtime (scripting development)
Declaration
protected CaseAvailableFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Remarks
Use GetSourceFileName(string) in your constructor for the source file name
Methods
View SourceIsAvailable()
Entry point for the runtime
Declaration
public bool? IsAvailable()
Returns
| Type | Description |
|---|---|
| bool? |
Remarks
Internal usage only, do not call this method