Custom expression function in sync rule doesn’t return NULL


Some days ago I faced a problem at a customer site with datetime attribute flows.
Users have separation dates as long as they have a limited contract, but when they got an unlimited contract the separation date is removed (NULL in database).

I’ve got a response from a system owner that dates for users with unlimited contract will not be cleared in their system.
First thought was I may be forgot to set the “allow Null on export” flag. But it was set on that attribute which is exported as a string value.

My sync rules custom expression was like this:

DateTimeFormat(SeparationDate,"yyyy-MM-dd") => ContractEndDate

After some investigation I found out that this expression does not return a NULL value if separation date is not set.
Never read that behavior in any documentation if I remember correctly.

So I modified the custom expression a bit like this:

IIF(IsPresent(SeparationDate),DateTimeFormat(dfgSeparationDate,"yyyy-MM-dd"),nullString)

And it works.

The nullString is an empty metaverse attribute on user objects which will never get a value, so it always is NULL.
All my implementation have this empty objects because they are very useful on clearing attributes in data sources when using sync rules.
Beside the nullString attribute I also have the nullReference attribute.

Keep in mind that the Null() function in custom expressions means “do nothing” and does not return a Null value.

Don’t know if this is also relevant to other functions of custom expressions, but it could be.

 

Advertisements

About Peter Stapf
Senior Consultant Identity and Access MVP (Enterprise Mobility)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: