MappingFunctionErrorParsingDate at Enterprise App Provisioning - Successfactor to Active Directory

Michal Ziemba 221 Reputation points
2022-01-17T12:53:45.957+00:00

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?

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,947 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,696 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michal Ziemba 221 Reputation points
    2022-01-25T11:46:57.053+00:00

    I found the solution.
    The documentation of the IIF command says that:
    "If the source attribute used within the IIF function is empty or null, the condition check fails" but I found it working OK and it seems to be the only way to get my logic working.
    Here is my condition which has been tested OK.

    IIF(Not(IsNullOrEmpty([endDate])),  
    	IIF(DateDiff("d", Now(), CDate(IIF(IsNullOrEmpty([endDate]),"9999-01-01",[endDate]))) < -14,   
    		"True",   
    		"False"  
    	),  
    	"False"	  
    )  
    

    Let me know if this is unsupported or is it a mistake in the documentation?

    1 person found this answer helpful.