Remove leading zeros from attribute values with a portal sync rule custom expression


Note to Self.

Today I having the requirement of removing leading zeros from attribute employeeID.
Special situation is that employeeIDs can be range from 1 to 5 chars, like:

00002, 00013, 00204 and so on.

Looking at the possible function on sync rules first thought was that this would not be possible, but sometimes things can be easier than they look alike.

Simple replacing the 0 (zero) by spaces, then perform an LTrim and after that replacing the spaces back to 0 (zero) works very well.

So the portal sync rules custom expression goes like this:

ReplaceString(LTrim(ReplaceString(employeeID,"0"," "))," ","0")

 

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: