Class PayrunFunction
Payrun function
Inheritance
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public abstract class PayrunFunction : PayrollFunction, IDisposable
Remarks
This class sits between PayrollFunction and the concrete payrun function types. It adds the payrun execution context (job identity, retro period, forecast flag, cycle/period names) and the shared-memory facilities that allow functions running at different lifecycle stages to communicate without writing permanent data.
Execution order within a payrun:
- PayrunStartFunction — once at the start of the entire job.
- PayrunEmployeeAvailableFunction — once per employee (gate).
- PayrunEmployeeStartFunction — once per included employee.
- PayrunWageTypeAvailableFunction — once per wage type per employee (gate).
- WageTypeValueFunction / WageTypeResultFunction — value calculation and post-processing.
- CollectorStartFunction / CollectorApplyFunction / CollectorEndFunction — collector lifecycle.
- PayrunEmployeeEndFunction — once per included employee.
- PayrunEndFunction — once at the end of the entire job.
Runtime values are in-memory key/value string stores scoped to either the entire payrun (GetPayrunRuntimeValue(string) / SetPayrunRuntimeValue(string, string)) or to a single employee (GetEmployeeRuntimeValue(string) / SetEmployeeRuntimeValue(string, string)). They exist only for the duration of the payrun job and are not persisted.
Payrun results (SetPayrunResult(string, object, ValueType?, string, IEnumerable<string>, Dictionary<string, object>, string)) are durable named value entries written to the payrun result store and accessible by reports and downstream processes.
Constructors
View SourcePayrunFunction(object)
Initializes a new instance with the function runtime
Declaration
protected PayrunFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
PayrunFunction(string)
New function instance without runtime (scripting development)
Declaration
protected PayrunFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Properties
View SourceCycleName
The cycle name
Declaration
[ActionProperty("Cycle name", null)]
public string CycleName { get; }
Property Value
| Type | Description |
|---|---|
| string |
ExecutionPhase
The current execution phase of the payrun job (e.g. Setup, Execution, Cleanup)
Declaration
public PayrunExecutionPhase ExecutionPhase { get; }
Property Value
| Type | Description |
|---|---|
| PayrunExecutionPhase |
Forecast
Forecast name
Declaration
[ActionProperty("Forecast name", null)]
public string Forecast { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsCycleRetroPayrun
True for a retro payrun within the current cycle
Declaration
[ActionProperty("Test for cycle retro payrun", null)]
public bool IsCycleRetroPayrun { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsForecast
True for a forecast payrun
Declaration
[ActionProperty("Test for forecast", null)]
public bool IsForecast { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRetroPayrun
True for a retro payrun
Declaration
[ActionProperty("Test for retro payrun", null)]
public bool IsRetroPayrun { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PayrunId
The payrun id
Declaration
public int PayrunId { get; }
Property Value
| Type | Description |
|---|---|
| int |
PayrunName
The payrun name
Declaration
[ActionProperty("Payrun name", null)]
public string PayrunName { get; }
Property Value
| Type | Description |
|---|---|
| string |
PeriodName
The period name
Declaration
[ActionProperty("Period name", null)]
public string PeriodName { get; }
Property Value
| Type | Description |
|---|---|
| string |
PreviewJob
True when the payrun job was started in preview mode; results are calculated but not committed
Declaration
public bool PreviewJob { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Use this flag to suppress side-effects (e.g. task creation, webhook calls) that must not fire during previews.
RetroPeriod
The period being recalculated in a retro run; null for a normal payrun
Declaration
public DatePeriod RetroPeriod { get; }
Property Value
| Type | Description |
|---|---|
| DatePeriod |
Remarks
Use IsRetroPayrun as a guard. The retro period precedes the current evaluation period.
Methods
View SourceAnnualProjection(decimal, string)
Project a per-period amount to a cycle basis, apply a progressive range lookup, and return the per-period share of the result. Formula: Round(ApplyRangeValue(lookup, amount × PeriodsInCycle) / PeriodsInCycle, 2)
Declaration
[ActionParameter("periodAmount", "Per-period gross amount to project", new string[] { "Dec" }, null, null)]
[ActionParameter("lookup", "Range lookup name containing the cycle-basis rate or amount table", new string[] { "String" }, null, null)]
[PayrunAction("AnnualProjection", "Project per-period amount via cycle range lookup and return per-period share", new string[] { "Calculation" })]
public ActionValue AnnualProjection(decimal periodAmount, string lookup)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | periodAmount | |
| string | lookup |
Returns
| Type | Description |
|---|---|
| ActionValue |
CappedContribution(decimal, decimal, decimal)
Calculate a contribution on a capped cycle basis and return the per-period amount. Formula: Round(Min(periodAmount × PeriodsInCycle, cycleCap) / PeriodsInCycle × rate, 2) Returns 0 when cycleCap is 0 or negative.
Declaration
[ActionParameter("periodAmount", "Per-period gross amount", new string[] { "Dec" }, null, null)]
[ActionParameter("rate", "Contribution rate (e.g. 0.0274 for 2.74%)", new string[] { "Dec" }, null, null)]
[ActionParameter("cycleCap", "Cycle cap on the contribution base (0 = no cap)", new string[] { "Dec" }, null, null)]
[PayrunAction("CappedContribution", "Contribution on capped cycle basis, returned as per-period amount", new string[] { "Calculation" })]
public ActionValue CappedContribution(decimal periodAmount, decimal rate, decimal cycleCap)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | periodAmount | |
| decimal | rate | |
| decimal | cycleCap |
Returns
| Type | Description |
|---|---|
| ActionValue |
ContributionIfObligated(decimal, decimal, string)
Apply a contribution rate to a wage only when a boolean case field indicates obligation. Returns Round(wage × rate, 2) when the obligation field is true, and 0 otherwise.
Typical use: social insurance contributions that are only applicable to certain employee categories (e.g. mandatory pension, unemployment insurance, accident insurance), where the obligation status is stored as a case field and may change over time.
Declaration
[ActionParameter("wage", "Contribution base (wage or collector value)", new string[] { "Dec" }, null, null)]
[ActionParameter("rate", "Contribution rate to apply when obligated", new string[] { "Dec" }, null, null)]
[ActionParameter("obligationField", "Fully qualified case field name of the boolean obligation flag", new string[] { "String" }, null, null)]
[PayrunAction("ContributionIfObligated", "Apply a contribution rate only when the obligation case field is true", new string[] { "Calculation" })]
public ActionValue ContributionIfObligated(decimal wage, decimal rate, string obligationField)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wage | |
| decimal | rate | |
| string | obligationField |
Returns
| Type | Description |
|---|---|
| ActionValue |
CycleToPeriod(decimal)
Convert a cycle amount to the equivalent per-period amount. Formula: cycleAmount / PeriodsInCycle Applies to any amount defined on a full-cycle basis that must be distributed evenly across the payrun periods in the cycle.
Declaration
[ActionParameter("cycleAmount", "Amount defined on a full-cycle basis", new string[] { "Dec" }, null, null)]
[PayrunAction("CycleToPeriod", "Convert a cycle amount to the per-period equivalent", new string[] { "Calculation" })]
public ActionValue CycleToPeriod(decimal cycleAmount)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | cycleAmount |
Returns
| Type | Description |
|---|---|
| ActionValue |
D2Delta(decimal, decimal, decimal, decimal)
Calculate the period delta for an accumulating tax or contribution using the D2 correction formula. Formula: (ytdWage + currentWage) × rate − ytdAlreadyPaid
Returns a positive value when the cumulative liability increases (additional deduction), and a negative value when it decreases (refund, e.g. after a downward correction).
Typical use: income tax and social-contribution calculations that accumulate over the cycle and must produce the exact delta for the current period rather than a flat rate applied to the current period's income alone.
The caller supplies: ytdWage — sum of the taxable wage from all prior periods (via ^$.Cycle or GetConsolidatedWageTypeValue) currentWage — taxable wage of the current period ytdAlreadyPaid — sum of the tax or contribution already deducted in prior periods (via ^$.Cycle) rate — applicable rate for the current period (from lookup or case value)
Declaration
[ActionParameter("ytdWage", "Sum of the taxable wage from all prior periods of the current cycle", new string[] { "Dec" }, null, null)]
[ActionParameter("currentWage", "Taxable wage of the current period", new string[] { "Dec" }, null, null)]
[ActionParameter("ytdAlreadyPaid", "Sum of the tax or contribution already deducted in prior periods", new string[] { "Dec" }, null, null)]
[ActionParameter("rate", "Applicable rate for the full year-to-date liability calculation", new string[] { "Dec" }, null, null)]
[PayrunAction("D2Delta", "Period delta for accumulating tax via D2 formula: (ytdWage + currentWage) × rate − ytdAlreadyPaid", new string[] { "Calculation" })]
public ActionValue D2Delta(decimal ytdWage, decimal currentWage, decimal ytdAlreadyPaid, decimal rate)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | ytdWage | |
| decimal | currentWage | |
| decimal | ytdAlreadyPaid | |
| decimal | rate |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetCollectorCycleResults(CollectorCycleResultQuery)
Returns collector results for the current employee spanning one or more complete payroll cycles
Declaration
public IList<CollectorResult> GetCollectorCycleResults(CollectorCycleResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorCycleResultQuery | query | Cycle query specifying collector names, cycle count offset, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<CollectorResult> | List of CollectorResult covering the requested cycles |
Remarks
Collector equivalent of GetWageTypeCycleResults(WageTypeCycleResultQuery).
GetCollectorPeriodResults(CollectorPeriodResultQuery)
Returns collector results for the current employee spanning a number of payroll periods back from the current period
Declaration
public IList<CollectorResult> GetCollectorPeriodResults(CollectorPeriodResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorPeriodResultQuery | query | Period query specifying collector names, period count offset, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<CollectorResult> | List of CollectorResult covering the requested periods |
Remarks
Collector equivalent of GetPeriodWageTypeResults(WageTypePeriodResultQuery).
GetCollectorResults(CollectorRangeResultQuery)
Returns collector results for the current employee within an explicit date range
Declaration
public IList<CollectorResult> GetCollectorResults(CollectorRangeResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorRangeResultQuery | query | Range query specifying collector names, start/end dates, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<CollectorResult> | List of CollectorResult within the date range |
GetCollectorResults(IEnumerable<string>, DateTime, DateTime, string, PayrunJobStatus?, IEnumerable<string>)
Returns collector results for the current employee within an explicit date range (low-level overload)
Declaration
public IList<CollectorResult> GetCollectorResults(IEnumerable<string> collectorNames, DateTime start, DateTime end, string forecast = null, PayrunJobStatus? jobStatus = null, IEnumerable<string> tags = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | collectorNames | The PascalCase collector names to query |
| DateTime | start | Range start date (inclusive) |
| DateTime | end | Range end date (inclusive) |
| string | forecast | Optional forecast name; |
| PayrunJobStatus? | jobStatus | Optional job status filter; |
| IEnumerable<string> | tags | Optional tag filter |
Returns
| Type | Description |
|---|---|
| IList<CollectorResult> | List of CollectorResult within the date range |
GetConsolidatedCollectorCustomResults(CollectorConsolidatedResultQuery)
Returns consolidated custom collector results for the current employee, merging retro corrections into the base values
Declaration
public IList<CollectorCustomResult> GetConsolidatedCollectorCustomResults(CollectorConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorConsolidatedResultQuery | query | Consolidated query specifying collector names, reference period moment, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<CollectorCustomResult> | List of CollectorCustomResult with retro differences already applied |
Remarks
Set query.NoRetro = true to suppress retro merging.
GetConsolidatedCollectorResults(CollectorConsolidatedResultQuery)
Returns consolidated collector results for the current employee, merging retro corrections into the base values
Declaration
public IList<CollectorResult> GetConsolidatedCollectorResults(CollectorConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorConsolidatedResultQuery | query | Query specifying collector names, the reference period moment, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<CollectorResult> | List of CollectorResult with retro differences already applied |
Remarks
Equivalent to GetConsolidatedWageTypeResults(WageTypeConsolidatedResultQuery) but for collectors.
Retro merging can be suppressed with query.NoRetro = true.
GetConsolidatedCollectorValue(string, int)
Get consolidated collector value from a period offset to the current period. Uses the start date of the offset period as the consolidation moment. A negative offset covers past periods; for example, -11 consolidates the 12 most recent periods.
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[ActionParameter("periodOffset", "Period offset relative to the current period (e.g. -11 for 12-period window)", new string[] { "Int" }, null, null)]
[PayrunAction("GetConsolidatedCollectorValue", "Get consolidated collector value from a period offset", new string[] { "Collector" })]
public ActionValue GetConsolidatedCollectorValue(string name, int periodOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | periodOffset |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetConsolidatedWageTypeCustomResults(WageTypeConsolidatedResultQuery)
Returns consolidated custom wage type results for the current employee, merging retro corrections into the base values
Declaration
public IList<WageTypeCustomResult> GetConsolidatedWageTypeCustomResults(WageTypeConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeConsolidatedResultQuery | query | Consolidated query specifying wage type numbers, reference period moment, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeCustomResult> | List of WageTypeCustomResult with retro differences already applied |
Remarks
Set query.NoRetro = true to suppress retro merging.
GetConsolidatedWageTypeResults(WageTypeConsolidatedResultQuery)
Returns consolidated wage type results for the current employee, merging retro corrections into the base values
Declaration
public IList<WageTypeResult> GetConsolidatedWageTypeResults(WageTypeConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeConsolidatedResultQuery | query | Query specifying wage type numbers, the reference period moment, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeResult> | List of WageTypeResult with retro differences already applied |
Remarks
"Consolidated" means the engine merges any retro-payrun corrections for the queried periods
into the base results, so the returned values reflect the net committed amount.
Set query.NoRetro = true to suppress retro merging and return only base results.
Use GetWageTypeCycleResults(WageTypeCycleResultQuery) or GetPeriodWageTypeResults(WageTypePeriodResultQuery) when you
need raw per-period results without retro consolidation.
GetConsolidatedWageTypeValue(decimal, int)
Get consolidated wage type value by number from a period offset to the current period. Uses the start date of the offset period as the consolidation moment. A negative offset covers past periods; for example, -11 consolidates the 12 most recent periods.
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[ActionParameter("periodOffset", "Period offset relative to the current period (e.g. -11 for 12-period window)", new string[] { "Int" }, null, null)]
[PayrunAction("GetConsolidatedWageTypeValue", "Get consolidated wage type value from a period offset by number", new string[] { "WageType" })]
public ActionValue GetConsolidatedWageTypeValue(decimal number, int periodOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number | |
| int | periodOffset |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetConsolidatedWageTypeValue(string, int)
Get consolidated wage type value by name from a period offset to the current period. Uses the start date of the offset period as the consolidation moment. A negative offset covers past periods; for example, -11 consolidates the 12 most recent periods.
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[ActionParameter("periodOffset", "Period offset relative to the current period (e.g. -11 for 12-period window)", new string[] { "Int" }, null, null)]
[PayrunAction("GetConsolidatedWageTypeValue", "Get consolidated wage type value from a period offset by name", new string[] { "WageType" })]
public ActionValue GetConsolidatedWageTypeValue(string name, int periodOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | periodOffset |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetCycleCollectorValue(string)
Get collector year-to-date value
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[PayrunAction("GetCycleCollectorValue", "Get collector year-to-date value", new string[] { "Collector" })]
public ActionValue GetCycleCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetCycleWageTypeValue(decimal)
Get wage type year-to-date value by wage type number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetCycleWageTypeValue", "Get wage type year-to-date value by wage type number", new string[] { "WageType" })]
public ActionValue GetCycleWageTypeValue(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetCycleWageTypeValue(string)
Get wage type year-to-date value by wage type name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetCycleWageTypeValue", "Get wage type year-to-date value by wage type name", new string[] { "WageType" })]
public ActionValue GetCycleWageTypeValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetEmployeeRuntimeValue(string)
Returns the raw string value of an employee-scoped runtime entry for the current employee
Declaration
public string GetEmployeeRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| string | The stored string, or |
Remarks
Employee runtime values are scoped to the current employee and isolated from other employees. They allow data to flow from early functions (e.g. PayrunEmployeeStartFunction) to later ones (e.g. CollectorEndFunction, PayrunEmployeeEndFunction) for the same employee. In PayrunEndFunction, all employees' values are accessible via GetEmployeeRuntimeValues(string).
GetEmployeeRuntimeValue<T>(string)
Returns an employee-scoped runtime value deserialized to the specified type
Declaration
public T GetEmployeeRuntimeValue<T>(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| T | The deserialized value, or |
Type Parameters
| Name | Description |
|---|---|
| T | The target type; the stored JSON string is deserialized into this type |
GetNextCycleCollectorValue(string)
Get collector total value of the next cycle
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[PayrunAction("GetNextCycleCollectorValue", "Get collector total value of the next cycle", new string[] { "Collector" })]
public ActionValue GetNextCycleCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetNextCycleWageTypeValue(decimal)
Get wage type total value of the next cycle by wage type number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetNextCycleWageTypeValue", "Get wage type total value of the next cycle by number", new string[] { "WageType" })]
public ActionValue GetNextCycleWageTypeValue(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetNextCycleWageTypeValue(string)
Get wage type total value of the next cycle by wage type name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetNextCycleWageTypeValue", "Get wage type total value of the next cycle by name", new string[] { "WageType" })]
public ActionValue GetNextCycleWageTypeValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetNextPeriodCollectorValue(string)
Get collector value of the next period
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[PayrunAction("GetNextPeriodCollectorValue", "Get collector value of the next period", new string[] { "Collector" })]
public ActionValue GetNextPeriodCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetNextPeriodWageTypeValue(decimal)
Get wage type value of the next period by wage type number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetNextPeriodWageTypeValue", "Get wage type value of the next period by number", new string[] { "WageType" })]
public ActionValue GetNextPeriodWageTypeValue(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetNextPeriodWageTypeValue(string)
Get wage type value of the next period by wage type name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetNextPeriodWageTypeValue", "Get wage type value of the next period by name", new string[] { "WageType" })]
public ActionValue GetNextPeriodWageTypeValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPayrunJobAttribute(string)
Returns the value of a payrun job attribute by name
Declaration
public object GetPayrunJobAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
Returns
| Type | Description |
|---|---|
| object | The attribute value, or |
GetPayrunJobAttribute<T>(string, T)
Returns the typed value of a payrun job attribute by name
Declaration
public T GetPayrunJobAttribute<T>(string attributeName, T defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
| T | defaultValue | Value returned when the attribute does not exist |
Returns
| Type | Description |
|---|---|
| T | The typed attribute value, or |
Type Parameters
| Name | Description |
|---|---|
| T | The expected value type |
GetPayrunResult(string)
Returns a previously written payrun result value by name
Declaration
public object GetPayrunResult(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The result name as passed to SetPayrunResult(string, object, ValueType?, string, IEnumerable<string>, Dictionary<string, object>, string) |
Returns
| Type | Description |
|---|---|
| object | The raw result value, or |
GetPayrunResultValue(string)
Get payrun result value
Declaration
[ActionParameter("name", "The result name", new string[] { "String" }, null, null)]
[PayrunAction("GetPayrunResultValue", "Get payrun result value", new string[] { "Payrun" })]
public ActionValue GetPayrunResultValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPayrunResult<T>(string, T)
Returns a previously written payrun result value cast to the specified type
Declaration
public T GetPayrunResult<T>(string name, T defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The result name |
| T | defaultValue | Value returned when the result does not exist |
Returns
| Type | Description |
|---|---|
| T | The typed result value, or |
Type Parameters
| Name | Description |
|---|---|
| T | The expected value type |
GetPayrunRuntimeValue(string)
Returns the raw string value of a payrun-scoped runtime entry
Declaration
public string GetPayrunRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| string | The stored string, or |
Remarks
Payrun runtime values are shared across all functions within the same payrun job execution. They are ephemeral — written in one function (e.g. PayrunStartFunction) and readable in any later function within the same job. They are not persisted after the job completes. For complex types use GetPayrunRuntimeValue<T>(string) which deserializes from JSON.
GetPayrunRuntimeValue<T>(string)
Returns a payrun-scoped runtime value deserialized to the specified type
Declaration
public T GetPayrunRuntimeValue<T>(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| T | The deserialized value, or |
Type Parameters
| Name | Description |
|---|---|
| T | The target type; the stored JSON string is deserialized into this type |
GetPeriodWageTypeResults(WageTypePeriodResultQuery)
Returns wage type results for the current employee spanning a number of payroll periods back from the current period
Declaration
public IList<WageTypeResult> GetPeriodWageTypeResults(WageTypePeriodResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypePeriodResultQuery | query | Period query specifying wage type numbers, period count offset, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeResult> | List of WageTypeResult covering the requested periods |
Remarks
query.PeriodCount = 1 returns the previous period, query.PeriodCount = 3 the last three periods.
For full-cycle queries use GetWageTypeCycleResults(WageTypeCycleResultQuery); for an explicit date range use
GetWageTypeResults(WageTypeRangeResultQuery).
GetPrevCycleCollectorValue(string)
Get collector total value of the previous cycle
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[PayrunAction("GetPrevCycleCollectorValue", "Get collector total value of the previous cycle", new string[] { "Collector" })]
public ActionValue GetPrevCycleCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPrevCycleWageTypeValue(decimal)
Get wage type total value of the previous cycle by wage type number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetPrevCycleWageTypeValue", "Get wage type total value of the previous cycle by number", new string[] { "WageType" })]
public ActionValue GetPrevCycleWageTypeValue(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPrevCycleWageTypeValue(string)
Get wage type total value of the previous cycle by wage type name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetPrevCycleWageTypeValue", "Get wage type total value of the previous cycle by name", new string[] { "WageType" })]
public ActionValue GetPrevCycleWageTypeValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPrevPeriodCollectorValue(string)
Get collector value of the previous period
Declaration
[ActionParameter("name", "The collector name", new string[] { "String" }, null, null)]
[PayrunAction("GetPrevPeriodCollectorValue", "Get collector value of the previous period", new string[] { "Collector" })]
public ActionValue GetPrevPeriodCollectorValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPrevPeriodWageTypeValue(decimal)
Get wage type value of the previous period by wage type number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetPrevPeriodWageTypeValue", "Get wage type value of the previous period by number", new string[] { "WageType" })]
public ActionValue GetPrevPeriodWageTypeValue(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetPrevPeriodWageTypeValue(string)
Get wage type value of the previous period by wage type name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetPrevPeriodWageTypeValue", "Get wage type value of the previous period by name", new string[] { "WageType" })]
public ActionValue GetPrevPeriodWageTypeValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetRetroWageTypeValueSum(decimal)
Returns the net sum of all pending retro corrections for a wage type identified by number
Declaration
public decimal GetRetroWageTypeValueSum(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number | The wage type number |
Returns
| Type | Description |
|---|---|
| decimal | Sum of all retro correction deltas; zero when no corrections are pending |
Remarks
Typical use: add the retro correction to the current period's wage type value so the employee receives the missed amount in the current payslip.
Examples
// Include retro correction in the current period's gross salary
var retro = GetRetroWageTypeValueSum(1000m);
return GetCaseValue<decimal>("MonthlySalary") + retro;
View Source
GetRetroWageTypeValueSum(string)
Returns the net sum of all pending retro corrections for a wage type identified by name
Declaration
public decimal GetRetroWageTypeValueSum(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The wage type name |
Returns
| Type | Description |
|---|---|
| decimal | Sum of all retro correction deltas; zero when no corrections are pending |
GetRetroWageTypeValueSumByName(string)
Get sum of retro corrections for a wage type by name
Declaration
[ActionParameter("name", "The wage type name", new string[] { "String" }, null, null)]
[PayrunAction("GetRetroWageTypeValueSum", "Get sum of retro wage type corrections by name", new string[] { "WageType" })]
public ActionValue GetRetroWageTypeValueSumByName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetRetroWageTypeValueSumByNumber(decimal)
Get sum of retro corrections for a wage type by number
Declaration
[ActionParameter("number", "The wage type number", new string[] { "Dec" }, null, null)]
[PayrunAction("GetRetroWageTypeValueSum", "Get sum of retro wage type corrections by number", new string[] { "WageType" })]
public ActionValue GetRetroWageTypeValueSumByNumber(decimal number)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | number |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetRuntimeValue(string)
Get runtime action value
Declaration
[ActionParameter("key", "The value key", new string[] { "String" }, null, null)]
[PayrunAction("GetRuntimeValue", "Get payrun runtime value", new string[] { "Runtime" })]
public ActionValue GetRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetWageTypeCustomResults(WageTypeRangeResultQuery)
Returns custom wage type results (additional named values) for the current employee within an explicit date range
Declaration
public IList<WageTypeCustomResult> GetWageTypeCustomResults(WageTypeRangeResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeRangeResultQuery | query | Range query specifying wage type numbers, start/end dates, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeCustomResult> | List of WageTypeCustomResult within the date range |
Remarks
Custom results are the extra named values a WageTypeValueFunction stores via
AddCustomResult. Use this method to read them back in later functions.
GetWageTypeCycleResults(WageTypeCycleResultQuery)
Returns wage type results for the current employee spanning one or more complete payroll cycles
Declaration
public IList<WageTypeResult> GetWageTypeCycleResults(WageTypeCycleResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeCycleResultQuery | query | Cycle query specifying wage type numbers, cycle count offset, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeResult> | List of WageTypeResult covering the requested cycles |
Remarks
Use query.CycleCount = 1 for the previous cycle (YTD prior year),
query.CycleCount = 0 for the current cycle up to the evaluation period.
For finer period-level control use GetPeriodWageTypeResults(WageTypePeriodResultQuery).
GetWageTypeName(decimal)
Returns the name of a wage type by its numeric identifier
Declaration
public string GetWageTypeName(decimal wageTypeNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wageTypeNumber | The wage type number |
Returns
| Type | Description |
|---|---|
| string | The PascalCase wage type name |
GetWageTypeNumber(string)
Returns the numeric identifier of a wage type by its name
Declaration
public decimal GetWageTypeNumber(string wageTypeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | wageTypeName | The PascalCase wage type name |
Returns
| Type | Description |
|---|---|
| decimal | The wage type number |
Remarks
Use this to convert a readable name to a number before calling result query methods.
GetWageTypeResults(WageTypeRangeResultQuery)
Returns wage type results for the current employee within an explicit date range
Declaration
public IList<WageTypeResult> GetWageTypeResults(WageTypeRangeResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeRangeResultQuery | query | Range query specifying wage type numbers, start/end dates, forecast, job status, and tags |
Returns
| Type | Description |
|---|---|
| IList<WageTypeResult> | List of WageTypeResult within the date range |
GetWageTypeResults(IEnumerable<decimal>, DateTime, DateTime, string, PayrunJobStatus?, IEnumerable<string>)
Returns wage type results for the current employee within an explicit date range (low-level overload)
Declaration
public IList<WageTypeResult> GetWageTypeResults(IEnumerable<decimal> wageTypeNumbers, DateTime start, DateTime end, string forecast = null, PayrunJobStatus? jobStatus = null, IEnumerable<string> tags = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<decimal> | wageTypeNumbers | The wage type numbers to query |
| DateTime | start | Range start date (inclusive) |
| DateTime | end | Range end date (inclusive) |
| string | forecast | Optional forecast name; |
| PayrunJobStatus? | jobStatus | Optional job status filter; |
| IEnumerable<string> | tags | Optional tag filter; only results carrying all listed tags are returned |
Returns
| Type | Description |
|---|---|
| IList<WageTypeResult> | List of WageTypeResult within the date range |
GetWageTypeRetroResultSum(decimal)
Get summary of retro wage type results
Declaration
public decimal GetWageTypeRetroResultSum(decimal wageTypeNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wageTypeNumber | The wage type number |
Returns
| Type | Description |
|---|---|
| decimal | Retro employee wage type value (difference) |
GetWageTypeRetroResults(WageTypeResultQuery)
Returns the individual retro-correction amounts for a wage type across all pending retro periods
Declaration
public IList<decimal> GetWageTypeRetroResults(WageTypeResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| WageTypeResultQuery | query | Query identifying the wage type number and optional forecast/status/tag filters |
Returns
| Type | Description |
|---|---|
| IList<decimal> | List of correction deltas (positive = underpayment correction, negative = overpayment correction) |
Remarks
Each entry represents the difference between the recalculated and the originally committed result for one retro period. Use GetRetroWageTypeValueSum(decimal) to get the total correction in a single call.
HasEmployeeRuntimeValue(string)
Tests whether an employee-scoped runtime value with the given key exists for the current employee
Declaration
public bool HasEmployeeRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| bool |
|
HasPayrunRuntimeValue(string)
Tests whether a payrun-scoped runtime value with the given key exists
Declaration
public bool HasPayrunRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
Returns
| Type | Description |
|---|---|
| bool |
|
InsuranceWage(decimal, decimal, decimal, decimal, decimal, decimal)
Calculate the insurance wage for a period based on accumulated collector and prior wage, bounded by pro-rated annual minimum and maximum wage limits. This implements the standard SV insurance wage calculation pattern used across multiple insurance types and jurisdictions.
The annual limits are pro-rated to the accumulated SV days using the configured days-in-year basis (e.g. 360 for Swiss, 365 for other jurisdictions).
Behaviour by accumulated collector value: collector ≥ pro-rated max → result = proRatedMax − proRatedMin − prevWage collector ≥ pro-rated min → result = collector − proRatedMin − prevWage collector ≥ 0 → result = 0 − prevWage (only a refund of prior overpayment) collector < 0 → result = collector − prevWage (negative correction)
Returns 0 when collector is 0.
Declaration
[ActionParameter("collector", "Total accumulated collector value for the period (current + prior periods)", new string[] { "Dec" }, null, null)]
[ActionParameter("prevWage", "Sum of insurance wages already calculated in prior periods of this cycle", new string[] { "Dec" }, null, null)]
[ActionParameter("annualMinWage", "Annual minimum insured wage (0 = no minimum)", new string[] { "Dec" }, null, null)]
[ActionParameter("annualMaxWage", "Annual maximum insured wage (0 = no cap)", new string[] { "Dec" }, null, null)]
[ActionParameter("svDays", "Accumulated SV days from the accumulation period start to the current period end", new string[] { "Dec" }, null, null)]
[ActionParameter("daysInYear", "Day basis used to pro-rate annual limits (e.g. 360 or 365)", new string[] { "Dec" }, null, null)]
[PayrunAction("InsuranceWage", "Insurance wage bounded by pro-rated annual min/max limits", new string[] { "Calculation" })]
public ActionValue InsuranceWage(decimal collector, decimal prevWage, decimal annualMinWage, decimal annualMaxWage, decimal svDays, decimal daysInYear)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | collector | |
| decimal | prevWage | |
| decimal | annualMinWage | |
| decimal | annualMaxWage | |
| decimal | svDays | |
| decimal | daysInYear |
Returns
| Type | Description |
|---|---|
| ActionValue |
LinearPhaseOut(decimal, decimal, decimal, decimal)
Linear phase-out of an amount between a full-value threshold and a zero threshold. Returns maxAmount when value is at or below fullUpTo, zero when value is at or above zeroFrom, and a linearly interpolated amount in between.
Declaration
[ActionParameter("value", "Current value to evaluate", new string[] { "Dec" }, null, null)]
[ActionParameter("maxAmount", "Amount returned when value is at or below fullUpTo", new string[] { "Dec" }, null, null)]
[ActionParameter("fullUpTo", "Threshold at or below which the full amount applies", new string[] { "Dec" }, null, null)]
[ActionParameter("zeroFrom", "Threshold at or above which the amount is zero", new string[] { "Dec" }, null, null)]
[PayrunAction("LinearPhaseOut", "Linear phase-out between fullUpTo and zeroFrom thresholds", new string[] { "Calculation" })]
public ActionValue LinearPhaseOut(decimal value, decimal maxAmount, decimal fullUpTo, decimal zeroFrom)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | value | |
| decimal | maxAmount | |
| decimal | fullUpTo | |
| decimal | zeroFrom |
Returns
| Type | Description |
|---|---|
| ActionValue |
LookupRateContribution(decimal, string, string)
Read a rate from a lookup table and apply it to a wage. Formula: Round(wage × GetLookup(lookup, key), 2) Returns 0 when the lookup value is not found or the wage is 0. Use when the contribution rate is stored in a data regulation lookup and may change from cycle to cycle without requiring a script update.
Declaration
[ActionParameter("wage", "Contribution base (wage or collector value)", new string[] { "Dec" }, null, null)]
[ActionParameter("lookup", "Lookup name containing the rate value", new string[] { "String" }, null, null)]
[ActionParameter("key", "Lookup key to retrieve the rate (e.g. year, code, or category)", new string[] { "String" }, null, null)]
[PayrunAction("LookupRateContribution", "Read a rate from a lookup table and apply it to a wage", new string[] { "Calculation" })]
public ActionValue LookupRateContribution(decimal wage, string lookup, string key)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wage | |
| string | lookup | |
| string | key |
Returns
| Type | Description |
|---|---|
| ActionValue |
MinMaxContribution(decimal, decimal, decimal, decimal)
Clamp a wage to an optional minimum and maximum, then apply a contribution rate. Formula: Round(Min(Max(wage, minWage), maxWage) × rate, 2)
The wage is first raised to minWage if it falls below it (e.g. statutory minimum wage floor), then capped at maxWage if it exceeds it (e.g. social insurance ceiling). Pass 0 for minWage to skip the minimum, or 0 for maxWage to skip the maximum.
Returns 0 when wage is 0.
Declaration
[ActionParameter("wage", "Base wage before applying the contribution", new string[] { "Dec" }, null, null)]
[ActionParameter("rate", "Contribution rate (e.g. 0.05 for 5%)", new string[] { "Dec" }, null, null)]
[ActionParameter("minWage", "Minimum contribution base; wage is raised to this value if below it (0 = no minimum)", new string[] { "Dec" }, null, null)]
[ActionParameter("maxWage", "Maximum contribution base; wage is capped at this value if above it (0 = no maximum)", new string[] { "Dec" }, null, null)]
[PayrunAction("MinMaxContribution", "Apply a rate to a wage clamped between optional minimum and maximum bounds", new string[] { "Calculation" })]
public ActionValue MinMaxContribution(decimal wage, decimal rate, decimal minWage, decimal maxWage)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wage | |
| decimal | rate | |
| decimal | minWage | |
| decimal | maxWage |
Returns
| Type | Description |
|---|---|
| ActionValue |
PeriodToCycle(decimal)
Convert a per-period amount to the equivalent cycle amount. Formula: periodAmount × PeriodsInCycle Applies to any amount defined per period that must be projected to the full cycle for limit checks, rate lookups, or cycle-level reporting.
Declaration
[ActionParameter("periodAmount", "Amount defined on a per-period basis", new string[] { "Dec" }, null, null)]
[PayrunAction("PeriodToCycle", "Convert a per-period amount to the cycle equivalent", new string[] { "Calculation" })]
public ActionValue PeriodToCycle(decimal periodAmount)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | periodAmount |
Returns
| Type | Description |
|---|---|
| ActionValue |
PhaseIn(decimal, params decimal[])
Multiphase build-up: accumulates an amount across ordered income thresholds, each with its own rate. Phases are evaluated in ascending order; each phase covers the income between its lower and upper bound. The first phase starts at 0. The phases parameter is a flat array of alternating (upperBound, rate) pairs. The caller is responsible for any period conversion of the result.
Declaration
[ActionParameter("income", "Income to evaluate against the phase thresholds", new string[] { "Dec" }, null, null)]
[ActionParameter("phases", "Alternating upperBound and rate pairs defining each phase", new string[] { "Dec" }, null, null)]
[PayrunAction("PhaseIn", "Multi-phase build-up accumulator across income thresholds", new string[] { "Calculation" })]
public ActionValue PhaseIn(decimal income, params decimal[] phases)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | income | |
| decimal[] | phases |
Returns
| Type | Description |
|---|---|
| ActionValue |
PhaseOut(decimal, decimal, decimal, decimal)
Single-phase income-dependent reduction (phase-out). Formula: Max(0, maxAmount - Max(0, income - threshold) × phaseOutRate) Returns 0 when the income exceeds the point at which the reduction is fully phased out. Both input and output use the same unit; the caller is responsible for any period conversion.
Declaration
[ActionParameter("income", "Income against which the phase-out is calculated", new string[] { "Dec" }, null, null)]
[ActionParameter("maxAmount", "Maximum reduction amount at or below the threshold", new string[] { "Dec" }, null, null)]
[ActionParameter("threshold", "Income level above which the reduction starts to decrease", new string[] { "Dec" }, null, null)]
[ActionParameter("phaseOutRate", "Rate at which the reduction decreases per unit of income above threshold", new string[] { "Dec" }, null, null)]
[PayrunAction("PhaseOut", "Income-dependent single-phase reduction: Max(0, max - Max(0, income - threshold) × rate)", new string[] { "Calculation" })]
public ActionValue PhaseOut(decimal income, decimal maxAmount, decimal threshold, decimal phaseOutRate)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | income | |
| decimal | maxAmount | |
| decimal | threshold | |
| decimal | phaseOutRate |
Returns
| Type | Description |
|---|---|
| ActionValue |
ProRateByDays(decimal, decimal, decimal)
Pro-rate an amount from actual days to target days. Formula: actualDays > 0 ? Round(amount / actualDays × targetDays, 2) : 0 Returns 0 when actualDays is 0 or negative, avoiding division by zero. Typical use: extrapolate a partial-period amount to a full reference period, or scale a full-period amount down to effective worked days.
Declaration
[ActionParameter("amount", "Amount to pro-rate", new string[] { "Dec" }, null, null)]
[ActionParameter("actualDays", "Actual number of days the amount covers", new string[] { "Dec" }, null, null)]
[ActionParameter("targetDays", "Target number of days to scale the amount to", new string[] { "Dec" }, null, null)]
[PayrunAction("ProRateByDays", "Pro-rate an amount from actual days to target days", new string[] { "Calculation" })]
public ActionValue ProRateByDays(decimal amount, decimal actualDays, decimal targetDays)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | amount | |
| decimal | actualDays | |
| decimal | targetDays |
Returns
| Type | Description |
|---|---|
| ActionValue |
RateContribution(decimal, decimal)
Apply a flat rate to a wage and return the rounded contribution amount. Formula: Round(wage × rate, 2) Returns 0 when wage or rate is 0. Use when the contribution base is already the correct period amount and no cycle projection or capping is required.
Declaration
[ActionParameter("wage", "Contribution base (wage or collector value)", new string[] { "Dec" }, null, null)]
[ActionParameter("rate", "Contribution rate (e.g. 0.1307 for 13.07%)", new string[] { "Dec" }, null, null)]
[PayrunAction("RateContribution", "Apply a flat rate to a wage and return the rounded contribution", new string[] { "Calculation" })]
public ActionValue RateContribution(decimal wage, decimal rate)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | wage | |
| decimal | rate |
Returns
| Type | Description |
|---|---|
| ActionValue |
RemovePayrunJobAttribute(string)
Removes a payrun job attribute by name
Declaration
public bool RemovePayrunJobAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveRuntimeValue(string)
Remove runtime action value
Declaration
[ActionParameter("key", "The value key", new string[] { "String" }, null, null)]
[PayrunAction("RemoveRuntimeValue", "Remove payrun runtime value", new string[] { "Runtime" })]
public void RemoveRuntimeValue(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key |
RoundToFraction(decimal, decimal)
Round an amount to the nearest fraction defined by a denominator. Formula: Round(amount × denominator) / denominator Common denominators: 100 = cents, 20 = twentieth, 4 = quarter, 2 = half. Returns 0 when denominator is 0 or negative.
Declaration
[ActionParameter("amount", "Amount to round", new string[] { "Dec" }, null, null)]
[ActionParameter("denominator", "Rounding denominator (e.g. 100 for cents, 20 for twentieth)", new string[] { "Dec" }, null, null)]
[PayrunAction("RoundToFraction", "Round an amount to the nearest 1/denominator", new string[] { "Calculation" })]
public ActionValue RoundToFraction(decimal amount, decimal denominator)
Parameters
| Type | Name | Description |
|---|---|---|
| decimal | amount | |
| decimal | denominator |
Returns
| Type | Description |
|---|---|
| ActionValue |
SetEmployeeRuntimeValue(string, string)
Writes an employee-scoped runtime value as a raw string for the current employee
Declaration
public void SetEmployeeRuntimeValue(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
| string | value | The string value to store; pass |
SetEmployeeRuntimeValue<T>(string, T)
Serializes a value to JSON and writes it as an employee-scoped runtime entry for the current employee
Declaration
public void SetEmployeeRuntimeValue<T>(string key, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
| T | value | The value to serialize and store; pass |
Type Parameters
| Name | Description |
|---|---|
| T | The value type to serialize |
SetPayrunJobAttribute(string, object)
Creates or updates a payrun job attribute
Declaration
public void SetPayrunJobAttribute(string attributeName, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
| object | value | The attribute value to store |
SetPayrunResult(string, object, DateTime, DateTime, ValueType?, string, IEnumerable<string>, Dictionary<string, object>, string)
Writes a named payrun result for an explicit date range to the durable payrun result store
Declaration
public void SetPayrunResult(string name, object value, DateTime startDate, DateTime endDate, ValueType? valueType = null, string slot = null, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Unique result name within this payrun execution |
| object | value | The result value; serialized to JSON internally |
| DateTime | startDate | The result validity start date |
| DateTime | endDate | The result validity end date |
| ValueType? | valueType | Explicit value type; inferred from |
| string | slot | Optional slot name for multi-slot results |
| IEnumerable<string> | tags | Optional result tags for filtering |
| Dictionary<string, object> | attributes | Optional key/value metadata attached to the result |
| string | culture | Optional culture for value formatting |
Remarks
Use this overload when the result must cover a date range different from the current payroll period.
SetPayrunResult(string, object, ValueType?, string, IEnumerable<string>, Dictionary<string, object>, string)
Writes a named payrun result for the current period to the durable payrun result store
Declaration
public void SetPayrunResult(string name, object value, ValueType? valueType = null, string slot = null, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Unique result name within this payrun execution |
| object | value | The result value; serialized to JSON internally |
| ValueType? | valueType | Explicit value type; inferred from |
| string | slot | Optional slot name for multi-slot results |
| IEnumerable<string> | tags | Optional result tags for filtering |
| Dictionary<string, object> | attributes | Optional key/value metadata attached to the result |
| string | culture | Optional culture for value formatting |
Remarks
Payrun results are durable — unlike runtime values, they are persisted after
the payrun completes and are accessible by reports via ExecutePayrunResultQuery.
Use them to publish derived metrics (totals, counts, flags) that reports or downstream
processes need to consume. The name must be unique within the payrun job.
SetPayrunResultValue(string, object, string)
Set payrun result value
Declaration
[ActionParameter("name", "The result name", new string[] { "String" }, null, null)]
[ActionParameter("value", "The value to set", null, null, null)]
[ActionParameter("type", "The value type (default: Money)", new string[] { "String" }, null, null)]
[PayrunAction("SetPayrunResultValue", "Set payrun result value", new string[] { "Payrun" })]
public void SetPayrunResultValue(string name, object value, string type = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| object | value | |
| string | type |
SetPayrunRuntimeValue(string, string)
Writes a payrun-scoped runtime value as a raw string
Declaration
public void SetPayrunRuntimeValue(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
| string | value | The string value to store; pass |
Remarks
Values written here are visible to all subsequent functions within the same payrun job. Use SetPayrunRuntimeValue<T>(string, T) to serialize complex types to JSON automatically.
SetPayrunRuntimeValue<T>(string, T)
Serializes a value to JSON and writes it as a payrun-scoped runtime entry
Declaration
public void SetPayrunRuntimeValue<T>(string key, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The value key |
| T | value | The value to serialize and store |
Type Parameters
| Name | Description |
|---|---|
| T | The value type to serialize |
SetRuntimeValue(string, object)
Set runtime action value
Declaration
[ActionParameter("key", "The value key", new string[] { "String" }, null, null)]
[ActionParameter("value", "The value to set", null, null, null)]
[PayrunAction("SetRuntimeValue", "Set payrun runtime value", new string[] { "Runtime" })]
public void SetRuntimeValue(string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | |
| object | value |