Skip to Content
Technical Articles
Author's profile photo Priyanka Agarwal

Configuring First Half or Second Half Leave Request Scenario

Introduction:

Requesting leaves using mobile is one of the most used Employee Self Service scenario next to recording Timesheets.
It is quite common that an Employee needs to request half day leaves either in the first half of the day or in the second half of the day. Often it gets difficult to track or report these half day leaves for a duration-based user because there is no start and end times entered while requesting leave for a duration-based user as they only need to enter the duration of leave. Hence, it is required that Employee enters additional information about the leave i.e. whether the leave was taken in the first half or the second half.

In this blog post you will learn how to configure requesting of leaves in first half of the day or during second half of the day for a duration-based user.

I want to highlight that this half day leave request solution with conditional custom field also works with Mobile Time Off.

Solution Proposal:

This solution makes use of a custom conditional field with a predefined name and a take rule.

The custom conditional field is used so that the field only appears on the UI when employee is requesting a half day leave.

The Take Rule is used to validate that the system doesn’t accept first half or second half leave two times. If Employee already requested leave during the first half, then he(she) should not be allowed to request a leave again in the first half.

Additionally, if you want to report on exact hours of first half leave or second half leave, you can create 2 more custom conditional fields of types start time and end time. Please note that these 2 custom fields will not be visible on mobile because of current limitation with general custom conditional fields.

Step 1: Create a Picklist

Go to Picklist Center and create a picklist with values “First Half” and “Second Half”.

Step 2: Create a custom field in Employee Time object definition

Go to Configure Object Definitions->Object Definition->Employee Time and create a new custom field with name as “cust_AmPmForFractionLeave”. If you use this name, then this custom conditional field would also appear on Mobile device.

Make sure that you set the field property Required = “Yes”. This will ensure that the field is mandatory while creating a leave.

 

Step 3: Define a condition on this custom field with FractionQuantity

Click on the details of the custom field and maintain the condition based on the Field Id as fractionQuantity. If your Time Type configuration is in days and Permitted Fractions For Unit Day = “Half day bookings allowed”, then use 0.5 in the condition value.

If your Time Type configuration is in hours and you have used “Full hours booking allowed”, then you can select the number of hours in the condition value depending on what hours constitutes half day as per your work schedule(E.g. 4 hours for a half day leave for a 8 hour/day work schedule day model).

In my example, I have used the Time Type with unit “Days”, hence the fractionQuantity selected is 0.5

Here is how you can define additional custom conditional start time and end time fields which can be used for reporting exact hours. You need to define the same condition on fractionQuantity for these custom fields as well. You can include it as per your needs. In my test scenario, I have not included these custom fields.

Step 4: Configure the Take Rule on Time type

The take rule is used to validate that the leave is not requested twice in the first half of the day for example.

First, you need to use 2 variables to get the existing leave with first half and second half using a lookup. In the lookup, you need to take care that you are not retrieving the cancelled and declined entries.

Second, add the if conditions to check if the requested leave is already in the database. If already present, then raise an error.

It is important to include the processing action of the take rule so that the validation is triggered for both create and edit scenarios. In the edit case, if both values are in the database, then do not allow editing. In this case, employee needs to cancel the leave and create a new one.

Alternatively, if you want you can raise specific error message on each “or” condition. For example, you can raise a separate message if user has already requested for first half and trying to request again. Similarly, you can raise a separate error message for the edit case.

Now, let’s take a look how it works!

Let’s say Employee is requesting leave on first half of the day for 23rd Feb,2021.

The custom field will be displayed as a mandatory field on the UI if the Requesting quantity is selected as 0.5 days as shown below.

Employee requests the leave for the first half and submits the leave.

Now, Employee is trying to create the leave request on the same date(23rd Feb,2021) for first half again.

Error is thrown as expected and the employee is not allowed submit this leave.

In order to keep the brevity of the blog post, I have not added the screenshots of the edit case but it works with the above take rule.

Conclusion:

In this blog post, you have learnt how to configure the solution for requesting leaves on first half or second half of the day using a custom conditional field and a take rule. This solution works for both web as well as mobile devices. The solution can be adapted depending on your business needs.

Looking forward to your comments and feedback.

Assigned Tags

      14 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Vilma Padilla
      Vilma Padilla
      Thanks for your valuable explanation! I am looking for a way to request an absence that lasts half a day but that can be requested for several days 
      
      For example when I change end date to a day later, 0.5 days automatically changes to 1 full day and so on, I would like for it to be half days  for example 3 calendar days = 1.5days

       

      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi Vilma Padilla ,

      You can use Flexible Requesting if you want to enter a free value to the requesting field. For this you would need to make your work schedule as Flexible Requesting as well as your Time Type.

      Kind Regards,

      Priyanka

      Author's profile photo Elsa Markoulidou
      Elsa Markoulidou

      Hello Priyanka,

      very nice blog.

      We're interested in doing something similar for HR Renewal 1. We already had it working with ESS, but are having trouble after the migration. For example, we had used a customer field as a radio button group, but it now appears as an input field. We're wondering if there is a more standard way now that we are missing.

      Thanks in advance.

      Kind regards,

      Elsa M

      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi Elsa Markoulidou ,

      This solution is only for SuccessFactors Time Off. What exactly did you mean by HR Renewal? Did you mean the EHP5 on-premise solution?

      Kind Regards,

      Priyanka

      Author's profile photo Elsa Markoulidou
      Elsa Markoulidou

      Yes, EHP7 actually. We're moving from WD ABAP to UI5

      Author's profile photo Sunil Satuluri
      Sunil Satuluri

      Hi Priyanka,

      We tried this rule. When absence request is in Declined status and user is trying to apply again,  system is not allowing. In short, system is checking AM PM from Declined requests.

      Can you please check once from your end as well and let me know. 

      Thanks

      Sunil

      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi Sunil Satuluri ,

      It seems we have limitation in the lookup function if you use "not equal to"  twice , it doesn't work.

      The limitation is documented here: https://help.sap.com/docs/SAP_SUCCESSFACTORS_PLATFORM/b37699fa8054409787a8321c9428aeca/7a74825c2a114a03a51c05c6a174b261.html

      In the lookup function,you can't define a restriction for the same field with the same operator in the Where condition.

      For example:

       

      • Username is not equal to “Name1”

      • Username is not equal to “Name2”

      In such cases, only the first restriction is taken into account, the subsequent restrictions are ignored.

      You can try using "Equal to" and give all the relevant statuses like "Approved", "Pending", "Pending Cancellation".

      Kind Regards,

      Priyanka

      Author's profile photo Sunil Satuluri
      Sunil Satuluri

      Hi Priyanka,

      Thank you so much. It is working with "Equal to".

      Regards

      Sunil

      Author's profile photo WS M. Tam
      WS M. Tam

      Hi Priyanka,

       

      Thank you so much for your useful information and valuable sharing. We have encounrted a problem how could we set the business rule to avoid users applying the half day-leave with different time type (leave type) in same period.

      For example, an employee applies for 0.5 days of Annual Leave in the morning of 31 Aug in advance, and then applied for a half-day compensation leave for the same period (the morning of 31 Aug). Currently, the Business Rule you have shared above do nothing to prevent this duplicate application of different time types. 

      It is appreciated if you could sharing your professional experience to solve this problem please.

      Many thanks for taking the time to help us in advance.

      Best Regards,

      M. Tam

      
                    
      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi WS M. Tam ,

      I need to update the screenshot of the validation rule with usage of Equal to sign instead of Not Equal To.

      It seems we have limitation in the lookup function if you use "not equal to"  twice , it doesn't work.

      The limitation is documented here: https://help.sap.com/docs/SAP_SUCCESSFACTORS_PLATFORM/b37699fa8054409787a8321c9428aeca/7a74825c2a114a03a51c05c6a174b261.html

      In the lookup function,you can't define a restriction for the same field with the same operator in the Where condition.

      For example:

      • Username is not equal to “Name1”

      • Username is not equal to “Name2”

      In such cases, only the first restriction is taken into account, the subsequent restrictions are ignored.

      You can try using "Equal to" and give all the relevant statuses like "Approved", "Pending", "Pending Cancellation".

      Kind Regards,

      Priyanka

      Author's profile photo WS M. Tam
      WS M. Tam

      Dear Priyanka,

       

      Thank you so much for your prompt reponses.

      According your valuable information, the new rule for validation of half day availability with different Time Type is created in system. Those rules are effective to avoid users applying the half day-leave in same period now.

      Please accept my gratitude.

       

      • Verify the availability with same Time Type

      Verify%20the%20availability%20with%20same%20Time%20Type

       

      • Verify the availability with different Time Type

      Verify%20the%20availability%20with%20different%20Time%20Type

       

      Best Regards,

      M. Tam

      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi WS M. Tam ,

      Does it work now?

      Kind Regards,

      Priyanka

      Author's profile photo WS M. Tam
      WS M. Tam

      Hi Priyanki,

       

      Yes, it works.

      Thanks.

       

      Best Regards,

      M. Tam

      Author's profile photo Priyanka Agarwal
      Priyanka Agarwal
      Blog Post Author

      Hi WS M. Tam

      Glad to hear that!

      I have updated the screenshot on the blog.

      Kind Regards,

      Priyanka