Check if account name exists?
Hy all. When doing inbound flow from HR how to check if the same account name already exists, and then by that generating new accountname. Something like that happens when I have in HR database employees with same Name and Surname. Anyway, because in HR database i don't have attribute AccountName i create one in FIM using inbound attribute flow custom expresion(eg. firstname + lastname). So how can i check if same accountname already exists and also how can I based on that generate different accountname (eg. if there is jsmith already present then create jsmith1).
March 1st, 2010 8:42pm

This is the routine I use in a Rules Extension to create unique account names. My account names can't be longer than 20 chars so you'll see me stripping off chars from the end when I start adding numbers. It's not the prettiest code in the world but it works. I vaguely remember finding it (or at least a large part of it) somewhere online, but I don't remember the original author.It's called from the MapAttributesForImport routine.Private Function GetUniqueAccountName(ByVal strAcctName As String, ByVal mventry As MVEntry) As String Dim findResultList() As MVEntry Dim checkedAcctName As String = strAcctName GetUniqueAccountName = "" Dim nameSuffix As Integer Dim mvEntryFound As MVEntry ' Create a unique naming attribute by adding a number to ' the existing strAcctName value. For nameSuffix = 1 To 100 ' Check if the passed strAcctName value exists in the metaverse by ' using the Utils.FindMVEntries method. findResultList = Utils.FindMVEntries("accountName", checkedAcctName, 1) ' If the value does not exist in the metaverse, use the passed value ' as the metaverse value. If findResultList.Length = 0 Then GetUniqueAccountName = checkedAcctName Exit For End If ' Check that the connector space entry is connected to the ' metaverse entry. mvEntryFound = findResultList(0) If mvEntryFound Is mventry Then GetUniqueAccountName = checkedAcctName Exit For End If ' If the passed value already exists, concatenate the counter number ' to the passed value and verify this new value exists. Repeat ' this step until a unique value is created. checkedAcctName = Left(strAcctName, 20 - Len(nameSuffix.ToString)) & nameSuffix.ToString Next End Function
Free Windows Admin Tool Kit Click here and download it now
March 1st, 2010 8:49pm

Thank you.But do you know is thera a way to do that using codeless provisioning?
March 1st, 2010 9:04pm

Unfortunately, that I don't know. I guess I'm kind of old-school in that I pretty much do everything through code.
Free Windows Admin Tool Kit Click here and download it now
March 1st, 2010 9:22pm

There's no way to do it with codeless.Henrik wrote a workflow action a while back http://www.idmcrisis.com/post/2009/03/31/ILM2-Unique-Name-Workflow-Activity.aspxBut of coure writing your own workflow activity also involves code... and for me old school's the way to go, as things stand at the moment.http://www.wapshere.com/missmiis
March 1st, 2010 9:35pm

Hy.Is there a way to include TazwellJ's code into my already in place codeless inbound provisioning rule?
Free Windows Admin Tool Kit Click here and download it now
March 3rd, 2010 1:46pm

Yes, you can combine codeless with traditional flow rules. You need to define an Advanced flow rule in the management agent, create a rules extension project, and add the code in as an Import flow rule. I suggest you read up on this in the ILM 2007 documentation if you haven't done this before. Have a look at this old blog post of mine too: http://www.wapshere.com/missmiis/advanced-attribute-flow-rules http://www.wapshere.com/missmiis
March 3rd, 2010 4:53pm

Hi TazwellJ . I'm using you code to create an unique account Name but with this rule extension every time that I update the user it creates a new Unique Account Name. Is there any way to indicate in the code to do it only the first Time???? Thanks In advace
Free Windows Admin Tool Kit Click here and download it now
September 25th, 2010 1:38am

I use some rules extension aswell, and this is how I do it: If (Not mventry("accountName").IsPresent()) Then 'add code to get new accountname 'add code to set mventry("accountName") to new name End This will make sure once a name is generated, it will never be updated. http://setspn.blogspot.com
September 25th, 2010 11:22am

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

Other recent topics Other recent topics