MIM 2016: IIF – Functions can’t be part of a value

Here is what I am trying to do in a Sync Rule

Custom Expression – IIF(Eq(employeetype,”FTE”),”Bas”+RandomNum(3,344), “Welcome17″)

It does not work, but if I do

Custom Expression – IIF(Eq(employeetype,”FTE”),”Bas”+”56″, “Welcome17”)

There is no problem

The Issue

The problem is with the comma in RandomNum function, if I also use RightPad function which has a comma, it errors also, but if I use a function that does not have a comma, no issue. The comma throws it off for IIF since that is used as a delimiter in the function.

The Solution

Use the Function method instead of the Custom Expression to compose the IIF. It can be quite a task when you are dealing with a lengthy and complex IIF but that is the way to by pass the syntax checker for IIF.

Advertisements