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 days with additional configuration

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:

  1. Go to Setup and select the Object Manager tab.
  2. Select the label for the Absence object.
  3. Select Fields & Relationships, and select New.

    Sage People displays the New Custom Field page.

  4. In the Data Type section, select Picklist, then select Next.

    Sage People displays Step 2: Enter the details:

    Step 2 in the creation of a custom picklist field for a custom object

  5. 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:
    AM

    PM

    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.
  6. Select Next.

    Sage People displays Step 3: Establish field-level security.

  7. Specify the field's access settings for each profile and select Next.

    Sage People displays Step 4: Add to page layouts.

  8. 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.

  9. Select Save & New.
  10. 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.
  11. On the Absence object page, select Field Sets.
  12. 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:

  1. Go to Setup and select the Object Manager tab.
  2. Select the label for the Absence object.
  3. Select Fields & Relationships, and select New.

    Sage People displays the New Custom Field page.

  4. In the Data Type section, select Formula, then select Next.

    Sage People displays Step 2: Choose output type.

  5. 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.

  6. Select Next.

    Sage People displays Step 3: Enter Formula.

  7. In the large text field, enter the following formula, replacing:

    • first-day-field-name and last-day-field-name with the Field Names of the picklist fields you created

    • AM and PM with the picklist values you used to represent morning and afternoon

    Copy
    IF(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

    ))))))))))))
  8. In the Blank Field Handling section, select Treat blank fields as blanks.
  9. Select Next.

    Sage People displays Step 4: Establish field-level security.

  10. Specify the field's access settings for each profile and select Next.

    Sage People displays Step 5: Add to page layouts

  11. 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.

  12. 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.

  1. Go to Setup and select the Object Manager tab.
  2. Select the label for the Absence object.
  3. Select Validation Rules, and select New.
  4. 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 Day

    Active

    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.

  5. 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, and AM and PM with the values in your last day picklist:

    Copy
    fHCM2__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")
  6. 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.

  7. Select Save.

Create a Salesforce Flow

To create a Salesforce Flow for calculating the absence duration and applying the partial day indicators: 

  1. Go to Setup and in Quick Find enter Flows.

  2. On the Flows page, select New Flow.

    Sage People displays the Flow Builder.

  3. On the New Flow window, select Record-Triggered Flow and then select Create.

  4. 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.

  5. 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.

  6. 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
  7. 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
  8. Set When to Run the Flow for Updated Records to Every time a record id updated and meets the condition requirements.
  9. Leave the Optimize the Flow for: value at the default option Actions and Related Records.

  10. Select Done.

    Sage People displays the Flow on the Flow Builder canvas.

  11. Select + between the Start and End elements and select the Update Triggering Record element.

    Sage People displays the New Update Records window.

  12. Enter a Label for the update. For example: Partial Day Update. The API name is automatically completed based on the Label.

  13. For How to Find Records to Update and Set Their Values, select Use the absence record that triggered the flow.

  14. In the Set Filter Conditions section, make sure None-Always Update Record is selected.

  15. In the Set Field Values for the Absence Record section, enter details as follows:

    1. Select Field and start typing Days, and select fHCM2__Days__c.

    2. Select the Value field and then select New Resource.

    3. On the New Resource screen, select the Resource Type picklist and choose Formula.

    4. 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:

      Copy
      IF( {!$Record.your-formula-field__c} > 0, {!$Record.fta__Calculated_Length__c}  - {!$Record.your-formula-field__c} ,  {!$Record.fta__Calculated_Length__c} )
    5. Select Done.

    6. Back on the New Update Records screen, select Add Field.

    7. Select Field and start typing Partial, and then select fta__Partial_Days_Options__c.

    8. Select the Value field and then select New Resource.

    9. On the New Resource screen, select the Resource Type picklist and choose Formula.

    10. 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 and last-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 replace AM and PM with the picklist options you are using.

      Copy
      IF(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",
      ""))))))))
    11. Select Done.

    12. Select Done to close the New Update Records screen.

  16. On the Flow Builder screen, select Save.

  17. 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.

  18. 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.

  19. When you are satisfied, select Activate.