Class PayrunStartFunction
Executes once at the start of a payrun, before any employee is processed.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class PayrunStartFunction : PayrunFunction, IDisposable
Remarks
This function is the global initializer for a payrun job. It runs exactly once per payrun execution, regardless of how many employees are included.
Typical uses:
- Initialize shared payrun-level runtime values (SetPayrunRuntimeValue(string, string)) that later employee functions can read via GetPayrunRuntimeValue(string).
- Validate payrun preconditions and abort the entire payrun by returning
false. - Log payrun metadata or set custom job attributes (SetPayrunJobAttribute(string, object)).
Return value: Return null to continue the payrun normally.
Return false to abort the entire payrun before any employee is processed.
Execution order: PayrunStart → (per employee) EmployeeAvailable → EmployeeStart → WageTypeAvailable → WageTypeValue → WageTypeResult → CollectorStart/Apply/End → EmployeeEnd → PayrunEnd.
Examples
// Abort the payrun if a required lookup is missing
if (!HasLookup("TaxRates"))
{
LogError("Required lookup TaxRates is missing.");
return false;
}
// Store the evaluation period start for use in employee functions
SetPayrunRuntimeValue("PeriodStart", PeriodStart.ToString("o"));
Constructors
View SourcePayrunStartFunction(object)
Initializes a new instance with the function runtime
Declaration
public PayrunStartFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
PayrunStartFunction(string)
New function instance without runtime (scripting development)
Declaration
protected PayrunStartFunction(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 SourceStart()
Entry point for the runtime
Declaration
public bool? Start()
Returns
| Type | Description |
|---|---|
| bool? |
Remarks
Internal usage only, do not call this method