Additional configuration for partial days
If your organization calculates absences in days, you can request a configuration package from your Customer Success Manager, or add configuration to enable partial day indicators to show if a partial day absence falls on the first or last part of the working day. When the configuration is in place, partial day absences display as triangles in the absence calendar in WX:
Partial day absences can be assigned to an absence applied to a single day, or to the first or last days of a more extended period. The additional configuration consists of new custom fields, a formula field, optional validation rule, and a flow. You need to:
-
Create two picklist fields in the Absence object:
-
A field to enable morning or afternoon to be selected for the first day of an absence. Use this field when applying a partial day to an absence that starts and ends on the same day.
-
A field to enable morning or afternoon to be selected for the last day of an absence. Use this field when applying a partial day to an absence that does not start and end on the same day.
Add the fields to Field Sets to display the fields in the WX self-service portal.
-
- Create a formula field in the Absence object for calculating the correct numerical value of partial days selected by the WX user.
- Create an optional validation rule for partial day absences on a single day. The validation rule displays an error if both the last day picklist is used for a partial day absence starting and ending on the same day.
- Create a Salesforce Flow. The flow calculates the duration of the absence and applies the partial day indicators to the first and last day of the absence according to the selected picklist values.
Create fields for indicating the part of day
To enable partial days to be applied to single day absences and to the first or last days of longer absences, create two fields on the Absence object for indicating the morning or afternoon of the day:
- Go to Setup and select the Object Manager tab.
- Select the label for the Absence object.
-
Select Fields & Relationships, and select New.
Sage People displays the New Custom Field page.
-
In the Data Type section, select Picklist, then select Next.
Sage People displays Step 2: Enter the details:
-
Complete the fields as follows:
Field What to enter Field Label Enter a label for the field. For example:
First Day
Values Select Enter values, with each value separated by a new line, then enter the values for the picklist. For example:
AMPM
Select the Restrict picklist to the values defined in the value set checkbox and leave the other checkboxes unchecked.
Field Name Automatically filled in from the Field Label. Description Optionally enter a description for the field. For example:
Field to indicate if the first day of an absence is a partial day.
Help Text Optionally enter help text for the field. For example:
Select a value to indicate if the first day of the absence falls on the morning or afternoon of the day.
Required Checkbox. Leave unchecked. Default Value Leave empty. -
Select Next.
Sage People displays Step 3: Establish field-level security.
-
Specify the field's access settings for each profile and select Next.
Sage People displays Step 4: Add to page layouts.
-
Choose the page layouts in the HR Manager portal where you want to display the field as an editable field. The field is added as the last field in the first two column section on the page layout. For long text area fields, the field is added to the end of the first one column section on the page layout. For user custom fields, the field is automatically added to the bottom of the user detail page.
- Select Save & New.
- Repeat steps 3 to 7 to create a picklist for the last day of the absence; suggested field label: Last Day. When you have completed Step 4: Add to page layouts, select Save.
- On the Absence object page, select Field Sets.
- Select the Field Sets controlling absence fields displayed to Team Members and Managers in WX and add the two picklist fields you created to the field sets.
Create a formula field for calculating the partial days
To create a formula field for calculating the partial days in the absence:
- Go to Setup and select the Object Manager tab.
- Select the label for the Absence object.
-
Select Fields & Relationships, and select New.
Sage People displays the New Custom Field page.
-
In the Data Type section, select Formula, then select Next.
Sage People displays Step 2: Choose output type.
-
Complete the fields as follows:
Field What to enter Field Label Enter a label for the field. For example:
Half Day Reduction
Field Name Automatically filled in from the Field Label. Formula Return Type Select Number.
Options Select the Decimal Places picklist and choose 1.
-
Select Next.
Sage People displays Step 3: Enter Formula.
-
In the large text field, enter the following formula, replacing:
-
first-day-field-name
andlast-day-field-name
with the Field Names of the picklist fields you created -
AM
andPM
with the picklist values you used to represent morning and afternoon
CopyIF(ISPICKVAL(first-day-field-name__c, 'AM') && fHCM2__Start_Date__c = fHCM2__End_Date__c , 0.5,
IF (ISPICKVAL(first-day-field-name__c, 'PM') && fHCM2__Start_Date__c = fHCM2__End_Date__c , 0.5,
IF(ISPICKVAL(last-day-field-name__c, 'AM' ) && fHCM2__Start_Date__c = fHCM2__End_Date__c , 0.5,
IF( ISPICKVAL(last-day-field-name__c, 'PM') && fHCM2__Start_Date__c = fHCM2__End_Date__c , 0.5,
IF(ISPICKVAL(first-day-field-name__c, 'AM') && ISBLANK(TEXT(last-day-field-name__c)) && fHCM2__Start_Date__c < fHCM2__End_Date__c , 0.5,
IF(ISPICKVAL(first-day-field-name__c, 'PM') && ISBLANK(TEXT(last-day-field-name__c)) && fHCM2__Start_Date__c < fHCM2__End_Date__c , 0.5,
IF(ISBLANK(TEXT(first-day-field-name__c)) && ISPICKVAL(last-day-field-name__c, 'AM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 0.5,
IF(ISBLANK(TEXT(first-day-field-name__c)) && ISPICKVAL(last-day-field-name__c, 'PM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 0.5,
IF(ISPICKVAL(first-day-field-name__c, 'PM') && ISPICKVAL(last-day-field-name__c, 'AM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 1,
IF(ISPICKVAL(first-day-field-name__c, 'AM') && ISPICKVAL(last-day-field-name__c, 'AM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 1,
IF(ISPICKVAL(first-day-field-name__c, 'AM') && ISPICKVAL(last-day-field-name__c, 'PM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 1,
IF(ISPICKVAL(first-day-field-name__c, 'PM') && ISPICKVAL(last-day-field-name__c, 'PM') && fHCM2__Start_Date__c < fHCM2__End_Date__c , 1,
0
)))))))))))) -
- In the Blank Field Handling section, select Treat blank fields as blanks.
-
Select Next.
Sage People displays Step 4: Establish field-level security.
-
Specify the field's access settings for each profile and select Next.
Sage People displays Step 5: Add to page layouts
-
Choose the page layouts you want to display the field as an editable field. The field is added as the last field in the first two column section on the page layout. For long text area fields, the field is added to the end of the first one column section on the page layout. For user custom fields, the field is automatically added to the bottom of the user detail page.
- Select Save.
Create a validation rule
To create a validation rule to display an error message when the last day picklist is used for partial day absences starting and ending on the same day. Sage People recommends using the first day picklist for these absences.
- Go to Setup and select the Object Manager tab.
- Select the label for the Absence object.
- Select Validation Rules, and select New.
-
On the Validation Rule Edit page, complete the details as follows:
Field What to enter Rule Name Enter a name for the rule. For example:
Last DayActive Checkbox.
Defaults to checked, do not uncheck.
Description Optionally enter a description of the rule. For example:
Displays an error if an option is selected in the Last Day picklist for a single day partial absence.
-
In the Error Condition Formula section, enter the following formula, replacing
last-day-field-name
with the Field Name of the your picklist field for the last day of the absence, andAM
andPM
with the values in your last day picklist:CopyfHCM2__Start_Date__c = fHCM2__End_Date__c &&ISPICKVAL(last-day-field-name__c, "AM") ||
fHCM2__Start_Date__c = fHCM2__End_Date__c && ISPICKVAL(last-day-field-name__c, "PM") -
Complete the fields in the Error Message section as follows:
Field Description Error Message Enter an error message to display when a Team Member selects a value in the Last Day picklist for a single day absence.
Error Location Select the location where the error message is shown in the HR Manager portal.
Does not apply to WX.
-
Select Save.
Create a Salesforce Flow
To create a Salesforce Flow for calculating the absence duration and applying the partial day indicators:
-
Go to Setup and in Quick Find enter Flows.
-
On the Flows page, select New Flow.
Sage People displays the Flow Builder.
-
On the New Flow window, select Record-Triggered Flow and then select Create.
-
On the Configure Start window, complete the fields as follows:
Field Description Object Picklist. The object hosting the records used to trigger the flow.
Select Absence fHMC2__Absence__c
Configure Trigger Radio buttons for selecting the event that triggers the flow.
Select A record is created or updated.
-
In the Set Entry Conditions section, select the Condition Requirements picklist and choose Any Condition Is Met (OR).
Sage People displays fields for the field to check, the operator, and value.
-
Complete the fields as follows:
Field Description Field Use the search to find and select the field you created to represent the first day of the absence, for example:
First_Day__c
Operator Select the picklist and choose Is Null
Value Select the field and choose $GlobalConstant.False -
Select + Add Condition and add a second field as follows:
Field Description Field Use the search to find and select the field you created to represent the last day of the absence, for example:
Last_Day__c
Operator Select the picklist and choose Is Null
Value Select the field and choose $GlobalConstant.False - Set When to Run the Flow for Updated Records to Every time a record id updated and meets the condition requirements.
-
Leave the Optimize the Flow for: value at the default option Actions and Related Records.
-
Select Done.
Sage People displays the Flow on the Flow Builder canvas.
-
Select + between the Start and End elements and select the Update Triggering Record element.
Sage People displays the New Update Records window.
-
Enter a Label for the update. For example: Partial Day Update. The API name is automatically completed based on the Label.
-
For How to Find Records to Update and Set Their Values, select Use the absence record that triggered the flow.
-
In the Set Filter Conditions section, make sure None-Always Update Record is selected.
-
In the Set Field Values for the Absence Record section, enter details as follows:
-
Select Field and start typing Days, and select fHCM2__Days__c.
-
Select the Value field and then select New Resource.
-
On the New Resource screen, select the Resource Type picklist and choose Formula.
-
Complete the fields as follows:
Field Description Resource Type Picklist
Automatically completed based on the previous step.
API Name The unique name of the resource in your org.
Letters, numbers, and underscores only.
Description Optional description for the resource.
For example:
Calculates the length of the absence using the Calculated Length field and the partial day formula.
Data Type Picklist.
Select Number
Decimal Places Enter 1 Formula Space to enter a formula and Insert a resource picklist.
Enter the following formula, replacing
your-formula-field
with the Field Name of the Formula field you created, using the Insert a resource picklist to ensure they are correct:CopyIF( {!$Record.your-formula-field__c} > 0, {!$Record.fta__Calculated_Length__c} - {!$Record.your-formula-field__c} , {!$Record.fta__Calculated_Length__c} )
-
Select Done.
-
Back on the New Update Records screen, select Add Field.
-
Select Field and start typing Partial, and then select fta__Partial_Days_Options__c.
-
Select the Value field and then select New Resource.
-
On the New Resource screen, select the Resource Type picklist and choose Formula.
-
Complete the fields as follows:
Field Description Resource Type Picklist
Automatically completed based on the previous step.
API Name The unique name of the resource in your org.
Letters, numbers, and underscores only.
Description Optional description for the resource.
For example:
Applies absence duration codes based on partial day picklist selections so the system can display the correct symbols in the absence calendar.
Data Type Picklist.
Select Text
Formula Space to enter a formula and Insert a resource picklist.
Enter the following formula, replacing
first-day-field-name
andlast-day-field-name
with the Field Names of the Picklist fields you created, using the Insert a resource picklist to ensure they are correct. If necessary also replaceAM
andPM
with the picklist options you are using.CopyIF(ISBLANK(TEXT({!$Record.first-day-field-name__c})) && ISPICKVAL({!$Record.last-day-field-name__c}, 'AM'), "01FFS",
IF(ISBLANK(TEXT({!$Record.first-day-field-name__c})) && ISPICKVAL({!$Record.last-day-field-name__c}, 'PM'), "01FFE",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'AM') && ISPICKVAL({!$Record.last-day-field-name__c}, 'AM'), "01SFS",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'PM') && ISPICKVAL({!$Record.last-day-field-name__c}, 'AM'), "01EFS",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'PM') && ISPICKVAL({!$Record.last-day-field-name__c}, 'PM'), "01EFE",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'AM') && ISPICKVAL({!$Record.last-day-field-name__c}, 'PM'), "01SFE",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'PM') && ISBLANK(TEXT({!$Record.last-day-field-name__c})), "01EFF",
IF(ISPICKVAL({!$Record.first-day-field-name__c}, 'AM') && ISBLANK(TEXT({!$Record.last-day-field-name__c})), "01SFF",
"")))))))) -
Select Done.
-
Select Done to close the New Update Records screen.
-
-
On the Flow Builder screen, select Save.
-
To check your work, select Debug. Debug highlights if you have made any obvious errors in field names or formula syntax.
If your flow has no errors, Sage People displays the Debug flow window.
-
Select a record you want to use in the debug run, and then select Run. When the run completes, you can view details of the run.
-
When you are satisfied, select Activate.