Show / Hide Table of Contents

Class CaseValidateFunction

Validates case field values when the user submits the input form.

Inheritance
object
Function
PayrollFunction
CaseFunction
CaseChangeFunction
CaseValidateFunction
Implements
IDisposable
Inherited Members
CaseChangeFunction.HiddenField(string)
CaseChangeFunction.VisibleField(string)
CaseChangeFunction.ShowFieldDescription(string)
CaseChangeFunction.SetFieldStartLabel(string, string)
CaseChangeFunction.SetFieldStartHelp(string, string)
CaseChangeFunction.SetFieldStartRequired(string)
CaseChangeFunction.SetFieldStartReadOnly(string)
CaseChangeFunction.SetFieldStartFormat(string, string)
CaseChangeFunction.SetFieldStartPickerOpenDay(string)
CaseChangeFunction.SetFieldStartPickerOpenMonth(string)
CaseChangeFunction.SetFieldStartPickerOpenYear(string)
CaseChangeFunction.SetFieldStartPickerTypeDateTime(string)
CaseChangeFunction.SetFieldEndLabel(string, string)
CaseChangeFunction.SetFieldEndHelp(string, string)
CaseChangeFunction.SetFieldEndRequired(string)
CaseChangeFunction.SetFieldEndReadOnly(string)
CaseChangeFunction.SetFieldEndFormat(string, string)
CaseChangeFunction.SetFieldEndPickerOpenDay(string)
CaseChangeFunction.SetFieldEndPickerOpenMonth(string)
CaseChangeFunction.SetFieldEndPickerOpenYear(string)
CaseChangeFunction.SetFieldEndPickerTypeDateTime(string)
CaseChangeFunction.SetFieldValueLabel(string, string)
CaseChangeFunction.SetFieldValueAdornment(string, string)
CaseChangeFunction.SetFieldValueHelp(string, string)
CaseChangeFunction.SetFieldValueMask(string, string)
CaseChangeFunction.SetFieldValueRequired(string)
CaseChangeFunction.SetFieldValueReadOnly(string)
CaseChangeFunction.SetFieldValuePickerOpenDay(string)
CaseChangeFunction.SetFieldValuePickerOpenMonth(string)
CaseChangeFunction.SetFieldValuePickerOpenYear(string)
CaseChangeFunction.SetFieldCulture(string, string)
CaseChangeFunction.SetFieldMinValue(string, object)
CaseChangeFunction.SetFieldMaxValue(string, object)
CaseChangeFunction.SetFieldStepSize(string, int)
CaseChangeFunction.SetFieldFormat(string, string)
CaseChangeFunction.SetFieldLineCount(string, int)
CaseChangeFunction.SetFieldMaxLength(string, int)
CaseChangeFunction.SetFieldCheck(string)
CaseChangeFunction.SetFieldAttachmentNone(string)
CaseChangeFunction.SetFieldAttachmentOptional(string)
CaseChangeFunction.SetFieldAttachmentMandatory(string)
CaseChangeFunction.SetFieldAttachmentExtensions(string, string)
CaseChangeFunction.CaseAvailable()
CaseChangeFunction.CaseAvailable(string)
CaseChangeFunction.SetCaseAttribute(string, object)
CaseChangeFunction.SetCaseAttribute(string, string, object)
CaseChangeFunction.RemoveCaseAttribute(string)
CaseChangeFunction.RemoveCaseAttribute(string, string)
CaseChangeFunction.GetReason()
CaseChangeFunction.SetReason(string)
CaseChangeFunction.GetForecast()
CaseChangeFunction.SetForecast(string)
CaseChangeFunction.HasFields()
CaseChangeFunction.IsFieldComplete(string)
CaseChangeFunction.IsFieldEmpty(string)
CaseChangeFunction.HasField(string)
CaseChangeFunction.FieldAvailable(string)
CaseChangeFunction.FieldAvailable(string, bool)
CaseChangeFunction.InitField(string, object, DateTime?, DateTime?)
CaseChangeFunction.SetField(string, object, DateTime?, DateTime?)
CaseChangeFunction.HasStart(string)
CaseChangeFunction.GetStart(string)
CaseChangeFunction.SetStart(string, DateTime?)
CaseChangeFunction.InitStart(string, DateTime?)
CaseChangeFunction.UpdateStart(DateTime?)
CaseChangeFunction.MandatoryEnd(string)
CaseChangeFunction.HasEnd(string)
CaseChangeFunction.GetEnd(string)
CaseChangeFunction.SetEnd(string, DateTime?)
CaseChangeFunction.InitEnd(string, DateTime?)
CaseChangeFunction.UpdateEnd(DateTime?)
CaseChangeFunction.MandatoryValue(string)
CaseChangeFunction.GetPeriod(string)
CaseChangeFunction.GetValueType(string)
CaseChangeFunction.HasValue(string)
CaseChangeFunction.GetValue(string)
CaseChangeFunction.GetValue(string, object)
CaseChangeFunction.GetValue<T>(string)
CaseChangeFunction.GetValue<T>(string, T)
CaseChangeFunction.SetValue(string, object)
CaseChangeFunction.SetValue(string, PayrollValue)
CaseChangeFunction.InitValue(string, object)
CaseChangeFunction.InitValue(string, PayrollValue)
CaseChangeFunction.AddCaseValueTag(string, string)
CaseChangeFunction.RemoveCaseValueTag(string, string)
CaseChangeFunction.SetCaseFieldAttribute(string, string, object)
CaseChangeFunction.RemoveCaseFieldAttribute(string, string)
CaseChangeFunction.SetCaseValueAttribute(string, string, object)
CaseChangeFunction.RemoveCaseValueAttribute(string, string)
CaseChangeFunction.ShowCaseField(string)
CaseChangeFunction.HideCaseField(string)
CaseChangeFunction.GetChangeCaseObject<T>()
CaseChangeFunction.SetChangeCaseObject<T>(T)
CaseChangeFunction.GetValueSlots(string)
CaseChangeFunction.GetValueSlots<T>(string)
CaseChangeFunction.CancellationDate
CaseChangeFunction.Cancellation
CaseChangeFunction.Start
CaseChangeFunction.End
CaseChangeFunction.Value
CaseChangeFunction.PayrollValue
CaseChangeFunction.FieldNames
CaseFunction.GetCaseAttribute(string)
CaseFunction.GetCaseAttribute<T>(string, T)
CaseFunction.CaseName
CaseFunction.CaseType
PayrollFunction.StringType
PayrollFunction.IntType
PayrollFunction.NumericType
PayrollFunction.DecimalType
PayrollFunction.DateType
PayrollFunction.TimeSpanType
PayrollFunction.BooleanType
PayrollFunction.HasFieldValue(string)
PayrollFunction.GetFieldValue(string)
PayrollFunction.HasLookupValue(string, ActionValue, string)
PayrollFunction.HasLookupValue(string, ActionValue, ActionValue, string)
PayrollFunction.GetLookupValue(string, ActionValue, string)
PayrollFunction.GetLookupValue(string, ActionValue, ActionValue, string)
PayrollFunction.ApplyRangeLookupValue(string, decimal, string)
PayrollFunction.Min(params ActionValue[])
PayrollFunction.Min(ActionValue, ActionValue)
PayrollFunction.Max(params ActionValue[])
PayrollFunction.Max(ActionValue, ActionValue)
PayrollFunction.Within(ActionValue, ActionValue, ActionValue)
PayrollFunction.Range(ActionValue, ActionValue, ActionValue)
PayrollFunction.Concat(params ActionValue[])
PayrollFunction.Contains(ActionValue, params ActionValue[])
PayrollFunction.GetTimeSpan(ActionValue, ActionValue)
PayrollFunction.SameYear(ActionValue, ActionValue)
PayrollFunction.SameMonth(ActionValue, ActionValue)
PayrollFunction.SameDay(ActionValue, ActionValue)
PayrollFunction.YearDiff(ActionValue, ActionValue)
PayrollFunction.Age(ActionValue, ActionValue)
PayrollFunction.IsNull(ActionValue)
PayrollFunction.IsNotNull(ActionValue)
PayrollFunction.IfNull(ActionValue, ActionValue)
PayrollFunction.IIf(bool, ActionValue, ActionValue)
PayrollFunction.SetNamespace(string, string)
PayrollFunction.Log(string, LogLevel)
PayrollFunction.GetCalendarPeriod(DateTime?, int)
PayrollFunction.GetCalendarDayCount(string)
PayrollFunction.GetEmployeeAttribute(string)
PayrollFunction.GetEmployeeAttribute<T>(string, T)
PayrollFunction.GetCycle(int)
PayrollFunction.GetCycle(DateTime, int)
PayrollFunction.GetPeriods(int, int)
PayrollFunction.GetCyclePeriods()
PayrollFunction.GetPastCyclePeriods(bool)
PayrollFunction.GetFutureCyclePeriods(bool)
PayrollFunction.IsFirstCycleDay(DateTime)
PayrollFunction.IsLastCycleDay(DateTime)
PayrollFunction.PastPeriod()
PayrollFunction.FuturePeriod()
PayrollFunction.GetPeriod(int)
PayrollFunction.GetPeriod(DateTime, int)
PayrollFunction.GetPeriodOffset(DateTime)
PayrollFunction.IsFirstPeriodDay(DateTime)
PayrollFunction.IsLastPeriodDay(DateTime)
PayrollFunction.GetCaseValueType(string)
PayrollFunction.HasCaseFieldAttribute(string, string)
PayrollFunction.GetCaseFieldAttribute(string, string)
PayrollFunction.GetCaseFieldAttribute<T>(string, string, T)
PayrollFunction.HasCaseValueAttribute(string, string)
PayrollFunction.GetCaseValueAttribute(string, string)
PayrollFunction.GetCaseValueAttribute<T>(string, string, T)
PayrollFunction.TestAvailableCaseValues(IEnumerable<string>)
PayrollFunction.TestAvailableCaseValues(DatePeriod, IEnumerable<string>)
PayrollFunction.GetFirstAvailableCaseValue(IEnumerable<string>)
PayrollFunction.GetFirstAvailableCaseValue(DatePeriod, IEnumerable<string>)
PayrollFunction.GetFirstUnavailableCaseValue(IEnumerable<string>)
PayrollFunction.GetFirstUnavailableCaseValue(DatePeriod, IEnumerable<string>)
PayrollFunction.CaseFieldSlot(string, string)
PayrollFunction.GetPeriodCaseValue<T>(DatePeriod, string, string)
PayrollFunction.GetPeriodCaseValue(DatePeriod, string, string)
PayrollFunction.GetPeriodCaseValues(DatePeriod, params string[])
PayrollFunction.GetPeriodCaseValues(int, params string[])
PayrollFunction.GetPeriodCaseValue<T>(int, string, string)
PayrollFunction.GetPeriodCaseValue(int, string, string)
PayrollFunction.GetCaseValue<T>(string, string)
PayrollFunction.GetCaseValue(string, string)
PayrollFunction.GetPeriodCaseValue(int, int, string, string)
PayrollFunction.GetMultiPeriodCaseValues(int, int, params string[])
PayrollFunction.GetRawCaseValue(string, DateTime)
PayrollFunction.GetRawCaseValues(IList<string>, DateTime)
PayrollFunction.GetRawCaseValue<T>(string, DateTime)
PayrollFunction.GetPeriodRawCaseValues(string, DatePeriod)
PayrollFunction.GetPeriodRawCaseValues(string)
PayrollFunction.GetPeriodRawCaseValues(string, int)
PayrollFunction.GetRawCaseValues(string, DateTime?, DateTime?)
PayrollFunction.GetCaseObjectValues<T>(bool, bool)
PayrollFunction.GetCaseObject<T>(List<CasePayrollValue>, DateTime)
PayrollFunction.GetRawCaseObject<T>(DateTime, bool)
PayrollFunction.GetPeriodRawCaseObjects<T>(List<DateTime>, bool)
PayrollFunction.GetCaseValues(params string[])
PayrollFunction.GetCaseValueTags(string)
PayrollFunction.GetCaseValueTags(string, DateTime)
PayrollFunction.GetCaseValueSlots(string)
PayrollFunction.GetSlotValues(string)
PayrollFunction.GetSlotValues<T>(string)
PayrollFunction.GetSlotByValue(string, string, string)
PayrollFunction.HasLookup(string)
PayrollFunction.GetLookup<T>(string, string, string)
PayrollFunction.GetLookup<T>(string, object[], string)
PayrollFunction.GetObjectLookup<T>(string, string, string, string)
PayrollFunction.GetLookupRanges(string, decimal?)
PayrollFunction.GetLookupThresholdRange(string, decimal)
PayrollFunction.GetLookupProgressiveRanges(string, decimal)
PayrollFunction.GetRangeLookup<T>(string, decimal, string, string)
PayrollFunction.GetRangeObjectLookup<T>(string, decimal, string, string, string)
PayrollFunction.ApplyRangeValue(string, decimal, string)
PayrollFunction.GetAttributeIssue(string, params object[])
PayrollFunction.None
PayrollFunction.Null
PayrollFunction.PayrollId
PayrollFunction.Namespace
PayrollFunction.HasNamespace
PayrollFunction.DivisionId
PayrollFunction.PayrollCulture
PayrollFunction.EmployeeId
PayrollFunction.EmployeeIdentifier
PayrollFunction.CycleStart
PayrollFunction.CycleStartYear
PayrollFunction.CycleStartMonth
PayrollFunction.CycleStartDay
PayrollFunction.CycleEnd
PayrollFunction.CycleEndYear
PayrollFunction.CycleEndMonth
PayrollFunction.CycleEndDay
PayrollFunction.CycleDuration
PayrollFunction.Cycle
PayrollFunction.CycleDays
PayrollFunction.PreviousCycle
PayrollFunction.NextCycle
PayrollFunction.EvaluationDate
PayrollFunction.EvaluationPeriod
PayrollFunction.Periods
PayrollFunction.PeriodStart
PayrollFunction.PeriodStartYear
PayrollFunction.PeriodStartMonth
PayrollFunction.PeriodStartDay
PayrollFunction.PeriodEnd
PayrollFunction.PeriodEndYear
PayrollFunction.PeriodEndMonth
PayrollFunction.PeriodEndDay
PayrollFunction.PeriodDuration
PayrollFunction.Period
PayrollFunction.PeriodDays
PayrollFunction.PreviousPeriod
PayrollFunction.NextPeriod
PayrollFunction.FirstCyclePeriod
PayrollFunction.LastCyclePeriod
PayrollFunction.CycleStartOffset
PayrollFunction.CycleEndOffset
PayrollFunction.PastCyclePeriods
PayrollFunction.FutureCyclePeriods
PayrollFunction.PeriodsInCycle
PayrollFunction.CaseValue
PayrollFunction.CaseValueTags
Function.GetTenantAttribute(string)
Function.GetTenantAttribute<T>(string, T)
Function.GetUserAttribute(string)
Function.GetUserAttribute<T>(string, T)
Function.GetDerivedCulture(int, int)
Function.GetDerivedCalendar(int, int)
Function.GetCalendarDayCount(DateTime, DateTime, string)
Function.GetCalendarDayCount(string, DateTime, DateTime, string)
Function.IsCalendarWorkDay(string, DateTime?)
Function.IsCalendarWorkDay(DateTime?)
Function.GetPreviousWorkDay(string, DateTime?)
Function.GetPreviousWorkDays(string, DateTime?, int)
Function.GetNextWorkDay(string, DateTime?)
Function.GetNextWorkDays(string, DateTime?, int)
Function.GetCalendarPeriod(DateTime?, int, int, int)
Function.GetCalendarPeriod(string, DateTime?, int, string)
Function.LogVerbose(string, string, string)
Function.LogDebug(string, string, string)
Function.LogInformation(string, string, string)
Function.LogWarning(string, string, string)
Function.LogError(string, string, string)
Function.LogError(Exception, string, string)
Function.LogFatal(string, string, string)
Function.LogFatal(Exception, string, string)
Function.Log(LogLevel, string, string, string)
Function.AddTask(string, string, DateTime, string, Dictionary<string, object>)
Function.InvokeWebhook<T>(string, object)
Function.GetSourceFileName(string)
Function.ChangeValueType<T>(object, T, IFormatProvider)
Function.Dispose()
Function.Runtime
Function.TenantId
Function.TenantIdentifier
Function.UserId
Function.UserIdentifier
Function.UserCulture
Function.UserType
Function.SelfServiceUser
Function.AdminUser
Function.SourceFileName
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CaseValidateFunction : CaseChangeFunction, IDisposable
Remarks

This function runs after the user confirms the case form. It checks field values for correctness and adds issues for any violations. Validation issues are displayed inline next to the affected field or at the case level.

Typical uses:

  • Check that a field value is within an allowed range.
  • Ensure date constraints: start must be before end, dates within the payroll period.
  • Cross-field validation: two fields that must be consistent with each other.
  • Business rules: reject submissions that conflict with existing case values.

Adding issues: Use AddCaseIssue(string) for case-level messages and AddCaseFieldIssue(string, string) to attach an issue to a specific field. Issues with localised messages can be added via AddCaseAttributeIssue(string, params object[]) and AddFieldAttributeIssue(string, string, params object[]) by referencing a lookup-backed ActionIssueAttribute.

Return value: Return null (or omit the return) to pass validation. Returning false marks the case as invalid without adding an explicit message. The runtime rejects the submission if any issues are present regardless of the return value.

Low-Code / No-Code: Simple validations can be expressed through action expressions using CaseValidateAction attributes — no C# scripting required. The Validate() entry point invokes all registered actions before executing any inline script body.

Examples
// Ensure a salary value is positive
if (GetValue<decimal>("Salary") <= 0)
    AddCaseFieldIssue("Salary", "Salary must be greater than zero.");
// Cross-field: end date must be after start date
if (GetEnd("Contract") <= GetStart("Contract"))
    AddCaseFieldIssue("Contract", "End date must be after start date.");

Constructors

View Source

CaseValidateFunction(object)

Initializes a new instance with the function runtime

Declaration
public CaseValidateFunction(object runtime)
Parameters
Type Name Description
object runtime

The runtime

View Source

CaseValidateFunction(string)

New function instance without runtime (scripting development)

Declaration
protected CaseValidateFunction(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 Source

AddAttributeIssue(string, string, params object[])

Adds a case field issue using a localised message from an attribute; alias for AddFieldAttributeIssue(string, string, params object[])

Declaration
public void AddAttributeIssue(string caseFieldName, string attributeName, params object[] parameters)
Parameters
Type Name Description
string caseFieldName

Case field name

string attributeName

Attribute name

object[] parameters

Optional message format parameters

View Source

AddCaseAttributeIssue(string, params object[])

Add case issue from attribute

Declaration
public void AddCaseAttributeIssue(string attributeName, params object[] parameters)
Parameters
Type Name Description
string attributeName

Attribute name

object[] parameters

Message parameters

View Source

AddCaseFieldIssue(string, string)

Add a new case field validation issue

Declaration
public void AddCaseFieldIssue(string caseFieldName, string message)
Parameters
Type Name Description
string caseFieldName

Name of the case field

string message

The issue message

View Source

AddCaseIssue(string)

Add a new case validation issue

Declaration
public void AddCaseIssue(string message)
Parameters
Type Name Description
string message

The issue message

View Source

AddFieldAttributeIssue(string, string, params object[])

Add case field issue from attribute

Declaration
public void AddFieldAttributeIssue(string caseFieldName, string attributeName, params object[] parameters)
Parameters
Type Name Description
string caseFieldName

Case field name

string attributeName

Attribute name

object[] parameters

Message parameters

View Source

AddInfo(string, object)

Adds or updates a named entry in the 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

View Source

HasIssues()

Test for issues

Declaration
public bool HasIssues()
Returns
Type Description
bool
View Source

RemoveInfo(string)

Removes a named entry from the form's edit-info attribute

Declaration
public void RemoveInfo(string name)
Parameters
Type Name Description
string name

The info entry name to remove

View Source

Validate()

Entry point for the runtime

Declaration
public bool? Validate()
Returns
Type Description
bool?
Remarks

Internal usage only, do not call this method

Implements

IDisposable

Extension Methods

ConsoleExtensions.WriteProperties(object, bool)
ValueTypeExtensions.GetValueType(object)
ObjectInfo.GetPropertyValue(object, string)
ObjectInfo.GetPropertyValue<T>(object, string, T)
ObjectInfo.ResolvePropertyValue(object, string)
ObjectInfo.SetPropertyValue(object, string, object)

See Also

CaseAvailableFunction
CaseBuildFunction
  • View Source
☀
☾
Back to top Generated by DocFX