Tuesday, July 26, 2011

Populating a RCDC dropdownlist with object masterdata information in FIM 2010 Portal

I have been playing around with the idea of populating master data (i.e. Department, Location,etc) into the FIM Portal and having this data presented in a dropdownlist. Presenting this information in a identitypicker, hyperlink, or listview is documented will enough so I will focus solely on the dropdownlist in this post.

Firstly I built a class called Department, added the relevant Attributes and binded everything up nicely. Next, I imported the departments into the Portal and tried to populate the dropdownlist. Here i ran into my first snag, as I could not populate this using the normal datasources provided in the RCDC datasources as per the Microsoft RCDC reference guide http://technet.microsoft.com/en-us/library/ee534918(WS.10).aspx#BKMK_DataSources.

I had a look at some of the posts on the FIM Forums, and saw an undocumented data source mentioned in the  http://social.technet.microsoft.com/Forums/en-HK/ilm2/thread/ae6e6eb4-e84b-44a7-8fd2-a9538cee4670 forum. I did some investigation and found that this data source was able to search objects and could easily populate my dropdownlist by creating a data source  in my RCDC configuration as below:

<my:ObjectDataSource my:TypeName="PrimaryResourceObjectDataSource" my:Name="object" my:Parameters=""/> 
<my:ObjectDataSource my:TypeName="PrimaryResourceDeltaDataSource" my:Name="delta"/>

<my:ObjectDataSource my:TypeName="PrimaryResourceRightsDataSource" my:Name="rights"/>
<my:ObjectDataSource my:TypeName="SchemaDataSource" my:Name="schema"/>

<my:ObjectDataSource my:TypeName="DomainDataSource" my:Name="domain"/>
<my:ObjectDataSource my:TypeName="TimeZoneDataSource" my:Name="timezone"/>

<my:ObjectDataSource my:TypeName="UocSearchDataSource" my:Name="search"/>

Now i was able to my create my dropdownlist object bound to department as below:

<my:Control my:Name="department" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=department.DisplayName}" my:Description="{Binding Source=schema, Path=department.Description}"  my:RightsLevel="{Binding Source=rights, Path=department}">
<my:Properties>
<my:Property my:Name="Required" my:Value="{Binding Source=schema, Path=department.Required}"/>
<my:Property my:Name="Columns" my:Value="40"/>

<my:Property my:Name="ItemSource" my:Value="{Binding Source=search, Path=Department}"/>
<my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=department, Mode=TwoWay}"/>
</my:Properties>
</my:Control>

There was however only one problem which I still had to resolve; being that although the values in the dropdownlist items were displayed as text, selecting an item stored the reference value of the selected item in the department attribute value.I looked at various options, and finally found the solution.

Enter the reference binding! Thanks to Almero (PuttyQ) for pointing me to a post by UNIFYBob http://social.technet.microsoft.com/wiki/contents/articles/3945.aspx which gave me the final pieces to the puzzle. By creating a reference (departmentRef in this case) and binding this value to the person, I was able to pass the reference correctly. So I amended my RCDC control to look a follows:

<my:Control my:Name="departmentRef" my:TypeName="UocDropDownList" my:Caption="{Binding Source=schema, Path=departmentRef.DisplayName}" my:Description="{Binding Source=schema, Path=departmentRef.Description}" my:RightsLevel="{Binding Source=rights, Path=departmentRef}">
<my:Properties>
<my:Property my:Name="Required" my:Value="{Binding Source=schema, Path=departmentRef.Required}"/>
<my:Property my:Name="Columns" my:Value="40"/>

<my:Property my:Name="ItemSource" my:Value="{Binding Source=search, Path=Department}"/>
<my:Property my:Name="SelectedValue" my:Value="{Binding Source=object, Path=departmentRef, Mode=TwoWay}"/>
</my:Properties>
</my:Control>

Now I was able to build some Portal or SyncEngine rules to push this information to my connected data sources.

8 comments:

  1. Very cool that my article was useful to you :)

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This is a great solution. Using a reference attribute is a good thing and a bad thing for me. Let's say I'm focused on the Department attribute. In the Portal, it's a reference attribute to accomodate the above solution. However, in 3 other directories, Department is a string. If I wanted use the portal for provisioning new users and have it be authoritative for Department, I run into problems. I'm forced to flow the reference attribure to a reference attribute in the Metaverse; limitation of FIM Service MA. But then I can't convert to a simple string name on the outbound to other directories; llimitation of working with reference attributes. Any ideas on how to handle this situation? Input greatly appreciated.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Found a solution. Did a workflow in Portal which took Department (Reference) and deReferenced to DeptTemp (String). To deReference use Target\DeptTemp = ""+Department in Worklfow. Workflow is triggered each time value of Department changes. I flow Portal.user.DeptTemp to mv.person.Department. When exporting mv.Person.Department I do a Utils.FindMVEntries to lookup csObjectID and return DisplayName.

    BTW...Department uses UocIdentityPicker & UocSearchDataSource to find Group Objects with CustomType = Department.

    Only downside....no pretty names for Department in MV; only csObjectIDs, but I can probably create a mv attribute to provide that if I wanted. Hope this helps someone.

    ReplyDelete
    Replies
    1. Hi Phil, de-referencing via a workflow is the most elegant solution, which is also the way I implemented this solution. Apologies for not replying sooner. I was in the process of relocation from South Africa to Australia.

      Delete
    2. This is amazing. Just what I was trying to achieve.

      Now... surely there's some way to filter the results returned to the drop down?

      Delete
  6. Is there a way we can filter only few departments rather than showing all the departments?
    I have a requirement to show two dropdowns where the second dropdown depends on the selected value in the first dropdown.

    can we achieve this?

    ReplyDelete