Class CaseBuildFunction
Populates case fields before the input form is displayed to the user.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CaseBuildFunction : CaseChangeFunction, IDisposable
Remarks
This function executes every time the case form is opened or refreshed. It is used to pre-fill default values, derive field content from existing case data, apply lookups, compute dates, and control which fields are shown or hidden.
Typical uses:
- Set
Start["Field"]andEnd["Field"]to default the value period. - Pre-fill
Value["Field"]from existing case values or lookups. - Show or hide fields with ShowCaseField(string) / HideCaseField(string).
- Mark the form as invalid with BuildInvalid() to block submission.
Return value: Return null to indicate a successful build.
Return false to mark the case as not buildable (equivalent to BuildInvalid()).
Low-Code / No-Code: Field population can also be expressed through
action expressions using CaseBuildAction attributes — no C# scripting required.
The Build() entry point invokes all registered actions before executing
any inline script body.
Examples
// Set the start date to today and derive a salary value
Start["Salary"] = PeriodStart;
Value["Salary"] = GetCaseValue<decimal>("BaseSalary") * 1.05m;
// Hide a field that is not applicable
if ((string)Employee["ContractType"] != "Management")
HideCaseField("ManagementBonus");
Constructors
View SourceCaseBuildFunction(object)
Initializes a new instance with the function runtime
Declaration
public CaseBuildFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
CaseBuildFunction(string)
New function instance without runtime (scripting development)
Declaration
protected CaseBuildFunction(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 SourceAddInfo(string, object)
Adds or updates a named entry in the case form's edit-info attribute
Declaration
public void AddInfo(string name, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The info entry name |
| object | value | The info entry value |
Build()
Entry point for the runtime
Declaration
public bool? Build()
Returns
| Type | Description |
|---|---|
| bool? |
Remarks
Internal usage only, do not call this method
BuildInvalid()
Marks the case form as invalid; submission is blocked
Declaration
public void BuildInvalid()
BuildValid()
Marks the case form as valid; submission is permitted
Declaration
public void BuildValid()
BuildValidity(bool)
Sets the validity state of the case form
Declaration
public void BuildValidity(bool valid)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | valid |
|
RemoveInfo(string)
Removes a named entry from the case form's edit-info attribute
Declaration
public void RemoveInfo(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The info entry name to remove |