How to disable accounts one day after the termination date

Problem

When an employee is terminated in UKG, Connect to AD will disable their Active Directory user on the next sync. However, this might lead to employees' accounts being disabled before their last work day ends.

Our objective is to ensure that their account remains active until the end of their final working day.

Solution

Open the Enable Account field mapping in Connect to AD. Switch to conditional expressions, add a condition, and paste the following expression to ensure the account is disabled as soon as the termination date has passed.

WHEN
Employment.EmployeeStatusCode == "T" && Employment.DateOfTermination.GetValueOrDefault().AddDays(1) <= DateTime.Today
THEN
false 
WHEN
Employment.EmployeeStatusCode == "Terminated" && Employment.DateTerminated.GetValueOrDefault().AddDays(1) <= DateTime.Today
THEN
false

Then, add a second condition to ensure other user accounts are enabled based on their employee state.

WHEN
Default
THEN
true

Summary

With this configuration, when an employee is terminated, their user account will remain active until the end of their last working day instead of it being disabled as soon as the termination date rolls in.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.