Class CaseRelationBuildFunction
Populates target case fields based on source case values when a case relation is applied.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CaseRelationBuildFunction : CaseRelationFunction, IDisposable
Remarks
This function runs whenever the source case is submitted and the relation is evaluated. It transfers, transforms, or derives values from the source case into the target case fields.
Available source accessors (read-only):
- SourceValue — indexer for source field values.
- SourceStart — indexer for source field start dates.
- SourceEnd — indexer for source field end dates.
- HasSourceValue(string) — test for defined source values.
Available target mutators (read-write):
- TargetValue — set a target field value.
- TargetStart — set the target field start date.
- TargetEnd — set the target field end date.
- CopyValue(string, string), CopyStart(string, string), CopyEnd(string, string) — copy fields unconditionally.
- InitValue(string, string), InitStart(string, string), InitEnd(string, string) — copy fields only if not already set.
Return value: Return null to indicate a successful build.
Return false to abort the build without modifying target fields.
Low-Code / No-Code: Field transfer can be expressed through
action expressions using CaseRelationBuildAction attributes — no C# scripting required.
The Build() entry point invokes all registered actions before executing
any inline script body.
Examples
// Copy wage from source to target with an 8 % surcharge
TargetValue["Wage"] = (decimal)SourceValue["Wage"] * 1.08m;
TargetStart["Wage"] = SourceStart["Wage"];
// Copy start date, shift end date by 3 months
CopyStart("Contract", "Contract");
TargetEnd["Contract"] = SourceEnd["Contract"]?.AddMonths(3);
Constructors
View SourceCaseRelationBuildFunction(object)
Initializes a new instance with the function runtime
Declaration
public CaseRelationBuildFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
CaseRelationBuildFunction(string)
New function instance without runtime (scripting development)
Declaration
protected CaseRelationBuildFunction(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 SourceBuild()
Entry point for the runtime
Declaration
public bool? Build()
Returns
| Type | Description |
|---|---|
| bool? |
Remarks
Internal usage only, do not call this method
GetSourceFieldEnd(string)
Get the case relation source field end date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetSourceFieldEnd", "Get the case relation source field end date", new string[] { "RelationField" })]
public ActionValue GetSourceFieldEnd(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the source case |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetSourceFieldStart(string)
Get the case relation source field start date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetSourceFieldStart", "Get the case relation source field start date", new string[] { "RelationField" })]
public ActionValue GetSourceFieldStart(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the source case |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetSourceFieldValue(string)
Get the case relation source field value
Declaration
[ActionParameter("field", "The case field on the source case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetSourceFieldValue", "Det the case relation source field value", new string[] { "RelationField" })]
public ActionValue GetSourceFieldValue(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the source case |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetTargetFieldEnd(string)
Get the case relation target field end date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetTargetFieldEnd", "Get the case relation target field end date", new string[] { "RelationField" })]
public ActionValue GetTargetFieldEnd(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetTargetFieldStart(string)
Get the case relation target field start date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetTargetFieldStart", "Get the case relation target field start date", new string[] { "RelationField" })]
public ActionValue GetTargetFieldStart(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
Returns
| Type | Description |
|---|---|
| ActionValue |
GetTargetFieldValue(string)
Get the case relation target field value
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[CaseRelationBuildAction("GetTargetFieldValue", "Get the case relation target field value", new string[] { "RelationField" })]
public ActionValue GetTargetFieldValue(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
Returns
| Type | Description |
|---|---|
| ActionValue |
SetTargetFieldEnd(string, DateTime?)
Set the case relation target field end date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[ActionParameter("end", "The end date to set", new string[] { "Date" }, null, null)]
[CaseRelationBuildAction("SetTargetFieldEnd", "Set the case relation target field change end date", new string[] { "RelationField" })]
public void SetTargetFieldEnd(string field, DateTime? end)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
| DateTime? | end | The end date to set |
SetTargetFieldStart(string, DateTime?)
Set the case relation target field start date
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[ActionParameter("start", "The start date to set", new string[] { "Date" }, null, null)]
[CaseRelationBuildAction("SetTargetFieldStart", "Set the case relation target field change start date", new string[] { "RelationField" })]
public void SetTargetFieldStart(string field, DateTime? start)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
| DateTime? | start | The start date to set |
SetTargetFieldValue(string, object)
Set the case relation target field value
Declaration
[ActionParameter("field", "The case field on the target case", new string[] { "String" }, null, null)]
[ActionParameter("value", "The value to set", null, null, null)]
[CaseRelationBuildAction("SetTargetFieldValue", "Set the case relation target field value", new string[] { "RelationField" })]
public void SetTargetFieldValue(string field, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | The case field on the target case |
| object | value | The value to set |