Custom Expression to determine HomeMDB
All, I want to make my sync rule more dynamic by adding logic to it to determine the right homeMDB location based on the first letter of the surname. - I have 8 Exchange databases so I have homeMDB strings - Every first letter of the surname has a corrosponding homeMDB string How can I put this into a custom expression? If this works I want to do the same with the msExchHomeServer attribute. example: a user is called John Doe. The first letter of the surname is D. D means that the mailbox must reside on "CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int" all help is appreciated! Thanks, TomTom
July 13th, 2010 6:59pm

I'm afraid you'll have to chain IIF expressions (sorry for the C-style comments): IIF( Eq(Uppercase(Left(LastName,1),"A")), // condition of the first IIF "CN=homeMDBA...", // value if true: the homemdb for users starting with 'A' IIF( // value if false: a new IIF expression: Eq(Uppercase(Left(LastName,1),"B")), // condition of the second IIF "CN=homeMDBB...", IIF( // and so on... Paolo Tedesco - http://cern.ch/idm
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2010 7:15pm

Hi Paolo, Thanks for your quick reply. I've tested your suggestion and created the following syntax: IIF( Eq(Uppercase(Left(LastName,1),"A")), "CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", IIF( Eq(Uppercase(Left(LastName,1),"B")), "CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", "CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int")) The error I get when I try this is in Dutch (as I use the Dutch language pack), the English translation would be something like: "The parameter of function Eq is not corresponding." Thanks for your help, it's very much appreciated! Tom
July 13th, 2010 9:20pm

I fixed the syntax, the correct syntax is: IIF(Eq(Left(lastName,1),"A"),"CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", IIF(Eq(Left(lastName,1),"B"),"CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", IIF(Eq(Left(lastName,1),"c"),"CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", IIF(Eq(Left(lastName,1),"D"),"GOED", IIF(Eq(Left(lastName,1),"E"),"GOED", IIF(Eq(Left(lastName,1),"F"),"GOED", IIF(Eq(Left(lastName,1),"G"),"GOED", IIF(Eq(Left(lastName,1),"H"),"GOED", IIF(Eq(Left(lastName,1),"I"),"GOED", IIF(Eq(Left(lastName,1),"J"),"GOED", IIF(Eq(Left(lastName,1),"K"),"GOED", IIF(Eq(Left(lastName,1),"L"),"GOED", IIF(Eq(Left(lastName,1),"M"),"GOED", IIF(Eq(Left(lastName,1),"N"),"GOED", IIF(Eq(Left(lastName,1),"O"),"GOED", IIF(Eq(Left(lastName,1),"P"),"CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int", IIF(Eq(Left(lastName,1),"Q"),"GOED", IIF(Eq(Left(lastName,1),"R"),"GOED", IIF(Eq(Left(lastName,1),"S"),"GOED", IIF(Eq(Left(lastName,1),"T"),"GOED", IIF(Eq(Left(lastName,1),"U"),"GOED", IIF(Eq(Left(lastName,1),"V"),"GOED", IIF(Eq(Left(lastName,1),"W"),"GOED", IIF(Eq(Left(lastName,1),"X"),"GOED", IIF(Eq(Left(lastName,1),"Y"),"GOED", IIF(Eq(Left(lastName,1),"Z"),"GOED","CN=DatabaseM-Z,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=Ruento,DC=int" )))))))))))))))))))))))))) Now I have the right syntax I notice that the attribute won't be filled with the result of the code. The AD user just has not homeMDB set and the Sync Engine gives an MA-Extention-Error. Any idea why this is not inserted in the homeMDB attribute in AD?Tom
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2010 11:53pm

Hi Tom, do you have more details on the ma-extension-error? Sadly, there's no way to debug a custom expression, so maybe you could try a rules extension. With that, you could debug the code and see what's happening, and, moreover, with such a long expression the rules extension might also be easier to maintain... Cheers, PaoloPaolo Tedesco - http://cern.ch/idm
July 14th, 2010 10:39am

It is true that having a better mechanism to debug custom expression would be helpful. However, there is already a little thing one can do - test the expression by using an operational MA in an inbound attribute flow mapping. For one, you can eliminate things such as precedence problems or general synchronization rule issues (such as ERL problems) as issues. I see way too many folks test complex expressions in the actual scenario, which makes it way too difficult to "debug" the expression. Cheers, MarkusMarkus Vilcinskas, Knowledge Engineer, Microsoft Corporation
Free Windows Admin Tool Kit Click here and download it now
July 14th, 2010 3:21pm

Is it possible to use the LessThan function with letters? Seems obvious so I'm sure the answer is as well but how helpful would that be in nesting these IIFs. By the way, I need to build a similar nexted expression only mine is even more complex as we only seperate by last name to two different homeMDBs if your in Region 6, but if you are a Director, VP, MD, or DO you go in a third and then all other users go in a default homeMDB. Kirk
January 25th, 2011 5:30pm

By the way, don't you only really need to nest down to L and then assume all others will be M-Z? You could cut your expression in half. Kirk p.s. I just realized this with my own as well.
Free Windows Admin Tool Kit Click here and download it now
January 25th, 2011 5:32pm

here is what I came up with. I have not yet tested this yet though :P IIF(Eq(Right(Region,1),"6"), IIF(Eq(Left(displayCredential,2),"MD"),"CN=Mgmt,...", IIF(Eq(Left(lastname,1),"A"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"B"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"C"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"D"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"E"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"F"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"G"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"H"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"I"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"J"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"K"),"CN=A-L,CN=CN=InformationStore,...", IIF(Eq(Left(lastname,1),"L"),"CN=A-L,CN=CN=InformationStore,...", "CN=M-Z,CN=CN=InformationStore,..."))))))))))))), "CN=Default,CN=InformationStore,...") => homeMDB
January 25th, 2011 7:37pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics