My use case is to disable the AD account based on the [endDate] from SuccessFactors delayed for 7 days.
I can disable the account using the following AD properties: [accountDisabled] or [accountExpires]
The second option is described at the function NumFromDate but without error handling.
I used the [info] AD property to write down my results and experiment. Here is what I found.
This condition works regardless of the [endDate] value (if it is empty, null, or set to date). This gives me the exact date of termination (if the user is terminated) or a text where it indicates that the [endDate] is not set.
switch( [endDate], Join(" ", "The endDate is : ", Coalesce([endDate]), ""), "", " the [endDate] is not set ")
In this condition, I calculate the difference (in days) between now() and the [endDate] using DateAdd. I use a switch in case of the calculation return a null or empty value. It works for a terminated user account but it doesn't work when the [endDate] is not set for active users. For the active user it returns the following error:
Error code: MappingFunctionErrorParsingDate
Error message: The mapping function cannot execute for source value . Expected Format is DateTime
switch( [endDate], Join(" ", "The delayed endDate is : ", Coalesce(DateAdd("d", 7, CDate([endDate])), "")), "", "the [endDate] is not set")
I have tried to use the IgnoreFlowIfNullOrEmpty function with the same result. Whenever the [endDate] is empty it fails with provisioning when there is any kind of calculation used on the [endDate] field.
IgnoreFlowIfNullOrEmpty(Switch([endDate], Join(" ", " * endDate: ", Coalesce(DateAdd("d", 7, CDate([endDate])), "")), "", "the [endDate] is not set"))
Any idea how to overcome it and build the proper condition which works regardless of the [endDate] value (if it is empty/null or with a date) and does some calculation in it without throwing an error?