Business Rule Methods
This topic provides a list of methods, a description of the method, and the accompanying parameters.
Dataform rules include Biz Logic, Hard Errors, and Soft Errors. These rules can trigger events, ensure that data does not become corrupt (for example, no duplicate SSN and FEIN), and manage the requirements of a workflow, along with any number of custom functions.
• | Business Logic Rules compare fields, perform calculations, change values of fields, validate values, and more. |
• | Hard Errors (HE) are hard and fast requirements that must be met before the action can be completed. These are most commonly used to require that data be entered before a certain step in the process but without making it a hard requirement to save the current dataform. |
• | Soft Errors (SE) are used as reminders and warnings. These can be configured as custom and complex warnings, or they can be simple warnings to remind someone to complete a specific field. |
For details about adding a business rule, see Configuring Rules and Business Logic.
Clear Field rules
You can automatically clear a field based on a specific trigger condition.
Method | Description | Parameters | ||||||
---|---|---|---|---|---|---|---|---|
_ClearFieldValue | Clears the value in a specific field on save. |
|
||||||
_ClearTabFieldValue | Clears a field on the sTabTableName dataform on save. |
|
Create Field rules
Method | Description | Parameters | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_CreateCalendarEvent |
|
|||||||||||||||||||
_CreateExportTransaction |
|
|||||||||||||||||||
_CreateExportTransactionAndData |
|
|||||||||||||||||||
_CreateExportTransactionAndDataByUser |
|
Required Field rules
The Required Field business rules enable a dataform field to be completed under certain circumstances.
Method | Description | Parameters | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_RequireFieldOnForm |
Allows you to make a core form field required for data entry. Trigger fields are optional. You can simply make the field required by identifying the field name in sFieldName or you can use the trigger fields in conjunction with sFieldName to make the field required when triggered. Note:
|
sFieldName |
||||||||||||
_RequireFieldOnThisForm | Checks for a value in a field on the current form. |
|
||||||||||||
_RequireTabField | Checks for a value in a field on a related tab. |
|
||||||||||||
_RequireAdHocField |
Checks for a value in a field that resides in a node that is embedded in the dataform XML packet. For example, there could be an Org node (on the PEO Client Master), and you want to require the Source field. In that case, the parameters would be:
|
|
Prevent duplicate records
By default, these rules validate other active dataforms of the same type within the same workspace. You can configure the rules with an All Workspaces flag, which allows the rule to validate across all workspaces with the dataform. Similarly, an Include Inactive flag allows the rule to include inactive records both within a workspace and across workspaces.
Method |
Description |
Parameters |
---|---|---|
_HE_PreventDuplicateRecords |
Hard Error that validates a unique dataform record based on a configured Field Name parameter (such as ImportID). Default behavior validates active dataforms within the same workspace. The default error message for this rule states, "This form cannot be saved because the value for '<fieldName>' is not unique." |
|
_SE_PreventDuplicateRecords |
Soft Error that validates a unique dataform record based on a configured Field Name parameter (such as ImportID). Default behavior validates active dataforms within the same workspace. The default error message for this rule states, "The value for <fieldName> is not unique to the system, are you sure you want to proceed?" |
|
Core rules
In addition to the standard required field rules, CORE rules allow for multiple trigger conditions when requiring fields. Core rules add an additional Trigger field and Trigger value in the parameter area of HE/SE_RequiredFieldEngine rule. Essentially this allows you to have multiple triggers for a required field rule.
Method | Description | Parameters | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_AddRowSecurity |
Add Row Security |
When triggered, adds row level (i.e., record level) security to the affected record for the current user that triggered the rule, any Global Administrator and an optional user, such as the "Assigned To" user, specified in the SecuredUser method parameter.
Note:
|
|||||||||||||||||||||||||||
_AddUserToWorkspace |
Add User |
When triggered, adds a user from a specified form and field to the workspace user list. The source form can be any single dataform in a workspace. The source field can be any user field on the trigger form. SourceForm: #ThisForm SourceField: FkUserID |
|||||||||||||||||||||||||||
_CalculateTimeDifference |
Calculate Value and Set Value |
When triggered, calculates the time difference between two DateTime datatype fields in Seconds (S), Minutes (MM), Hours (H), Days (D), Weeks (W), or Months (M) between and writes the value as a whole number to a specified TargetField. Set the following method parameters as applicable:
|
|||||||||||||||||||||||||||
HE_ExistingWorkspace |
Hard Error |
When triggered, if there is a workspace associated with the triggering organization, the following hard error displays: "This organization already has a Workspace associated with <WorkspaceName>. Please contact your system admin if you believe this is in error."
Note: Site must be configured to use rules on the organization. Please contact ClientSpace Professional Services if you want to activate this rule. |
|||||||||||||||||||||||||||
HE_RequireRateGroup |
Hard Error |
When triggered, validates Offered Benefit Plan (OBP) Rate Group(s) as follows on Add and Edit of an OBP:
|
|||||||||||||||||||||||||||
_SE_RequireFieldOnFormOnTrigger _HE_RequireFieldOnFormOnTrigger |
Soft Error Hard Error |
|
|||||||||||||||||||||||||||
_HE_DateBetween |
Hard Error |
This method calculates the time in days between two dates and determines whether the value is greater than or less than a limit (in days) that you set. This method is typically used to trigger a hard error when a date entered on a SIDES questionnaire does not fit the required SIDES parameters but could be repurposed for other scenarios where this type of comparison is required.
Method Parameters:
|
|||||||||||||||||||||||||||
_HE_DateComparison |
Hard Error |
This method compares two dates to determine if the first date is greater than or less than the second date. This method is typically used to trigger a hard error when a date entered on a SIDES questionnaire does not fit the required SIDES parameters but could be repurposed for other scenarios where this type of comparison is required.
Method Parameters:
|
|||||||||||||||||||||||||||
_HE_RequireFileDescription |
Hard Error |
Requires a document uploaded to a field that has a description before saving |
|||||||||||||||||||||||||||
_HE_RequireFileCategory |
Hard Error |
Requires a document uploaded to a field that has a category before saving |
|||||||||||||||||||||||||||
_HE_LimitFileUploadTypes |
Hard Error |
Limits the file types that can be saved into a field. |
|||||||||||||||||||||||||||
_HE_ValidateMinMax |
Hard Error |
Validates the minimum and maximum values for specific datatypes that support Integer, Number, Decimal, and Money. If the imported amount exceeds the minimum or maximum values, the import fails and records each failed issue. When all the values in the field meet the acceptable range, the dataform is updated. |
|||||||||||||||||||||||||||
_HE_ValidateIncidents |
Hard Error |
This method checks for open tasks associated with a case when a user changes the status of the case to Complete and the user attempts to save the case. If the case includes any incomplete tasks that are not marked Private, the system displays the following message: The following error(s) were found in your submission:
If the case includes any incomplete tasks that are marked Private, the system displays the following message: The following error(s) were found in your submission:
If the case includes any incomplete tasks that are marked Private AND the user is a Global Administrator, the system appends the following additional information to the end of message above: If private, please contact the following users - (<FirstName> <LastName>) |
Set Field rules
Sometimes you want to automatically set a field value based on a set of triggering parameters; for this reason, the _SetField rules were created.
The _SetField rules provide several non-specific trigger values:
• | #IsEmpty: fires the rule if the trigger field on the Triggering Form has no value |
• | #IsNotEmpty: fires the rule if the trigger field on the Triggering Form has some value - anything but empty |
• | #IsDirty: fires the rule if the trigger field on the Triggering Form has any value other than empty and has been changed prior to save |
These options and descriptions are in the contextual help (click the field label). The Trigger Values of this help are selectable links that fill the trigger field automatically.
Method | Description | Parameters | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_SetDateFieldValue | Sets a Date field on the TableName dataform. |
|
|||||||||||||||
_SetDateFieldValueFromSourceField | Sets the Date field from a field on another dataform. |
|
|||||||||||||||
_SetDateTimeFieldValue |
Sets a Date Time field on the TableName dataform. |
|
|||||||||||||||
_SetDateTimeFieldValueFromSourceField |
Sets the Date Time field from a field on another dataform. |
|
|||||||||||||||
_SetFieldFromKey | The Field Name of the field (on the Dataform Name dataform) into which the Record ID is inserted if the field is empty. Sets a Text or Integer field to that form's ID. If the field is already filled out, it does not replace the value. |
|
|||||||||||||||
_SetFieldFromLookupMetadata |
Sets a dataform field value on the triggering dataform from a field value on an associated metadata dataform when a lookup is selected that contains metadata. The source and target data types must be the compatible. Metadata field to Target field validation prevents you from specifying mismatched data types. Note: If there is no metadata available when the rule is triggered, the rule is skipped. |
|
|||||||||||||||
_SetFieldFromForm*** |
Sets a field on the TableName dataform from a field on another dataform. Sets a field on the current single dataform from a field on a different single dataform. Must be in the same workspace. The data types must match. For configuration purposes, TableName is the current (target) dataform. This is to be configured for single dataforms only. Leaving the TriggerField and TriggerValue blank when configuring this rule sets the value on save of trigger dataform. If improperly configured using multi-forms, the data is set from the most recently created form, even if it is inactivated. ***Can only be used on gen_ dataforms that are not Multiforms. |
|
|||||||||||||||
_SetFieldFromRelatedForm |
Sets a field on the child dataform from a field on a dataform that is defined as the related parent dataform regardless of workspace. Sets a field on the current:
Note:
|
|
|||||||||||||||
_SetFieldOnFormFromFormTabs |
Takes a value from a field on a dataform or tab dataform and sets it on another dataform or tab dataform. The new method supports the following configurations:
Note:
|
|
|||||||||||||||
_SetFieldOnRelatedForm |
Sets a field on the parent dataform from a field on a dataform that is defined as the related child dataform. Sets a field on the current:
Note:
|
|
|||||||||||||||
_SetFieldOnFormFromForm*** |
Sets a field on another dataform ( gen_DataformName) from a field on the current dataform (#ThisForm) or from another dataform (gen_DataFormName). Sets a field on a single dataform from a different single dataform in the same workspace. This is triggered by a third, completely different single dataform in the same workspace. The source and target data types must be the same. This is to be configured for single dataforms only. Leaving the TriggerField and TriggerValue blank when configuring this rule sets the value on save of trigger dataform. If improperly configured, when the source dataform is a multi-form, the data is set from the most recent source multiform, even if it is inactive. If the target dataform is a multiform, the data is set on the most recent multiform, even if it is inactive. When a rule uses this method and the system executes that rule, the system can copy up to 500 characters from the source field on the source dataform to the target field on the target dataform. ***Can only be used on gen_ dataforms that are not Multiforms. |
|
|||||||||||||||
_SetFieldValue | Sets a field on the TableName dataform on save |
|
|||||||||||||||
_SetFieldValueFromPattern |
This rule has the ability to extract the first instance of a value from within a text field using a valid .Net RegEx pattern and set the value of another text field on the same page to this extracted value. Some .Net regex patterns found online begin with the ^ character, which must be removed when configuring this rule. This business rule operates based on the following: The SourceField value is always be treated as textTargetField must be a Text data typeTargetField is ALWAYS overwritten with the results of the pattern matchSourceField and TargetField must be on the current dataform and cannot be used on tabbed forms. If the pattern match returns no value, the TargetField is cleared. |
|
|||||||||||||||
SetImportID |
Sets the ImportID on the State Master form equal to the State field on the same form. The ImportID will be refreshed if the State is updated. |
|
|||||||||||||||
_SetTabDateFieldValue | Sets a Date field on the sTabTableName dataform (i.e., Tab dataform associated with the triggering dataform) |
|
|||||||||||||||
_SetTabDateTimeFieldValue |
Sets a DateTime field on the TabTableName dataform (i.e., Tab dataform associated with the triggering dataform). |
|
|||||||||||||||
_SetTabFieldValue | Sets a field on the sTabTableName dataform on save. |
|
|||||||||||||||
_SetTabUserField | Sets a user field on the dataform tab that is a from a user field on the parent dataform of the tab. This only works from the Parent form to the Child form. |
|
|||||||||||||||
_SetUserField | Sets a user field on the same dataform. |
|
|||||||||||||||
SetFieldFromSalesEntity |
Sets a field on a form from a field on a Sales Entity dataform (System Admin > Administrative Data > Sales Entity) when the Client Master dataform is saved. Example:Update the Contract Effective Date on the Client Master with the Effective Date on the Sales Entity record.
The Sales Entity form used to update the TargetField is identified by matching the assigned user in the Sales Rep field and Contract Type on the Client Master with the sales entity record. If there is more than one Sales Entity form associated with the assigned user and matching Contract Type, the Sales Entity form with the Is Primary flag checked is used.
|
|
|||||||||||||||
SetPayrollFrequency |
Sets the Payroll Frequency field on a Pay Group. The SetPayrollFrequency method uses the difference between the Period Start and Period End date fields on the Pay Group to determine the pay frequency. The following list illustrates how the system determines the pay frequency:
|
||||||||||||||||
SetStaffingEmployeeRelatedFields |
Sets the Location, Comp Code, and Jurisdiction State from the selected Staffing Placement when the Staffing Placement field on the Comp Claim Claimant dataform is edited. The field state must be "IsDirty" and "NotEmpty". |
|
Stage Field rules
StageField rules allow you to prepare a field value to be saved to a target form and apply the change later in the save process based on a set of triggering parameters.
The _StageField rules provide several non-specific trigger values:
Method | Description | Parameters | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_StageChangesOnFormFromForm |
Prepares a field value on the source dataform ( gen_DataformName or #ThisForm) to be saved to a specified field of the same datatype on the target dataform (gen_DataFormName). The rule stages the field on a single dataform from a different single dataform in the same workspace. The rule is triggered by a third, completely different single dataform in the same workspace.
Note:
|
|
|||||||||||||||
_SaveStagedChanges |
Works in conjunction with _StageChangesOnFormFromForm. Saves any staged changes from a source form to an associated target form while following the specified pipelines that have been triggered prior to the triggering of this method. Note:
|
TargetForm: The dataform to which the data will be copied. Pipeline: The pipeline the rule should follow once triggered. (Validates against the Pipeline Code from the Pipeline Linking table.) |
Generating Merge Files
To assist in generating the merge files to prepare to send to DocuSign, the _GenerateMergeFile business rule can be configured to run the merge document and deposit the file in a field. This business rule can be configured multiple times to generate each file needed. After the business rules are run, you can review the documents in their individual file fields before you click the workflow link to send the files to DocuSign for signatures.
Method |
Description |
Parameters |
---|---|---|
_GenerateMergeFile |
When you create the rule, use the method _GenerateMergeFile. |
|
Change Workspace Template
You can create a rule that will allow you to change the workspace template. When triggered, the current workspace will be set to the template specified on the rule.
Method |
Description |
Parameters |
---|---|---|
SetWorkspaceTemplate | When you create the rule, use the method SetWorkspaceTemplate. Changing the workspace template will rebuild the workspace, inheriting the user and dataform values configured on the new template. |
|
Complete All Non-Archived Tasks
You can create a rule that will close all associated tasks on a dataform regardless of the origin of the task so that you do not have to close tasks manually.
Method |
Description |
---|---|
_TaskAutoCompleteAll | When you create the rule, use the method _TaskAutoCompleteAll. This method completes all non-archived tasks that are associated with a dataform except for tasks that define a recurring rule. |
Create Task
You can create a rule that will import historical incident data from another application into aClientSpace task within the correct Workspace.
Method |
Description |
---|---|
CreateTask | When you create the rule, use the method _CreateTask. The CreateTask method uses the Import_Incidents dataform to temporarily store incident information until the task information is extracted from it. The Import_Incident dataform is used in other import processes but contains the following fields specific to the CreateTask method:
Once a rule is triggered using the CreateTask method, an Import_Incident file is uploaded through Import Management. The file is processed, and each row is read and stored in the Import_Incident dataform until the task is generated. Then, the dataform is deleted. Any errors encountered during file processing are stored in the Import Log (without any disruption to Import_Incident file processing). Finally, the imported task information is imported into new ClientSpace task records within the correct Workspaces. |
Add Subscribers by Role
You can create a rule that will add subscribers based on their role on the client team instead of adding subscribers as specific users to each client service case.
Method |
Description |
Parameters |
---|---|---|
_AddSubscriber |
When you create the rule, use the method _AddSubscriber. This method adds a subscriber to a case by using a user field from an active, single dataform (for example, the client master). |
|
Mark Rehire
You can create a rule that sets the Rehire checkbox on the Employment dataform to checked when the employee’s Employment Status is updated from Terminated to Active so that you do not have to remember to click the Rehire checkbox manually.
Method | Description |
---|---|
MarkRehire | When a rule is triggered using the MarkRehiremethod, it sets the Rehire checkbox on the Employment dataform to checked when Employment Status is updated from Terminated to Active and the Last Hire Date is different from the Original Hire Date. |
Inactivate Deleted Employee
You can create a rule that sets the Employment Status field in the ClientSpace Employment record to "Deleted" and then deactivates the Employment record. The rule is triggered when a deleted employee record is imported by the PrismHR User Import API.
Method |
Description |
---|---|
InactivateDeletedEmployee |
The rule is triggered when a deleted employee is imported by the initial or ongoing PrismHR User Import API. The rule sets the Employment Status field on the Employment record to "Deleted", then deactivates the Employment record and related employee record by removing the check marks from the Active checkboxes on those forms. When you create the rule, use the following settings:
|
Inactivate Child Forms
When an imported PrismHR batch is in "Deleted" status, the Inactivate Child Forms rule deactivates the Payroll Batch as well as the associated Pay Groups and Billing Vouchers. The rule is triggered when a deleted Payroll Batch is imported by the PrismHR Payroll Batch Import API.
Method |
Description |
---|---|
InactivateChildForms |
The rule is triggered when a deleted Payroll Batch is imported by the PrismHR Payroll Batch Import API. The rule sets the Batch Status field on the Payroll Batch form to "Deleted", deactivates the Payroll Batch and deactivates associated Pay Groups and Billing Vouchers by removing the check marks from the Active checkboxes on these forms. Note: The rule needs to be configured on the same pipeline as the HRPAPI_payroll_batch*.csv import configuration so that it triggers when Payroll batches are imported. |
Primary and Secondary Trigger fields
When configuring business rules, the Primary Trigger Field and Secondary Trigger Field lists include fields that are User datatypes. Trigger value fields are text fields that support the following configurations:
• | A single User ID |
• | #IsDirty |
• | #IsEmpty |
Primary Trigger
• | Primary Trigger Field: can specify HdrAction or a field on the current dataform |
• | Primary Trigger Value: the HdrAction value or the field value used for comparison |
• | Compares Primary Trigger Field HdrAction value or the dataform field value with Primary Trigger Value entered |
• | The Primary Trigger Value must have changed for the rule to fire, based on the following criteria: |
• | If comparing HdrAction value, the HdrAction is assumed changed |
• | If comparing dataform field values (e.g., luState=MA), the dataform field must have changed |
• | If #IsEmpty, #IsNotEmpty, dataform field is assumed changed |
• | If #IsDirty dataform field must have changed |
• | Click the label for a list of # conditions that are hyperlinked to set the condition in Primary Trigger Value. |
Secondary Trigger
Secondary trigger field and value fields are enabled when a primary trigger condition has been set and are optional. Criteria for secondary trigger conditions are as follows:
• | Primary Trigger condition must be met. Secondary Trigger acts as an AND with Primary Trigger. |
• | Secondary Trigger Field: can specify HdrAction, a field on the current dataform, or a field from ServerDataProc1 or ServerDataProc2 |
• | Secondary Trigger Field: when using Server Data Procs, the format is SDP1.FieldName or SDP2.FieldName |
• | Secondary Trigger Value: the HdrAction value or the dataform/SPD1/SPD2 field value |
• | Compares Secondary Trigger Field HdrAction value or the dataform/ServerDataformProc field value with Secondary Trigger Value entered |
• | The Primary Trigger Value must have changed for the rule to fire, based on the following criteria: |
• | If comparing HdrAction value, the HdrAction is assumed changed |
• | If comparing SDP1/SDP2 value, the current value is assumed changed |
• | If comparing dataform field values (e.g., luState=MA), the current dataform field must have changed |
• | If #IsEmpty, #IsNotEmpty, current dataform/SPD1/SPD2 field is assumed changed |
• | If #IsDirty dataform field must have changed |
• | If #IsDirty previous value is assumed Empty, field must have changed (contains a value) |
• | Click the label to for a list of # conditions that are hyperlinked to set the condition in Secondary Trigger Value. |