RCDC Variables, and using them to scope a ListView or IdentityPicker

I don’t know how many times I’ve used the RCDC documentation, but somehow never noticed the bit on Environment Variables. Today however I was looking for a way to restrict the scope of a UocListView or UocIdentityPicker based on properties of the user being edited – and it turns out that you can reference any properties of the object using %Attribute_AttributeName%, then use it in a filter!

My goal was to restrict available roles based on a user’s EmployeeType. My “Role” objects have an attribute called “SubType” which matches the EmployeeType.  All I have to do is filter with an xpath query that references ‘%Attribute_EmployeeType%’. The same filter works for a UocListView too.

<my:Control my:Name="Role" my:TypeName="UocIdentityPicker" my:Caption="{Binding Source=schema, Path=Role.DisplayName}" my:Description="{Binding Source=schema, Path=Role.Description}">
	<my:Properties>
		<my:Property my:Name="Required" my:Value="false"/>
		<my:Property my:Name="Mode" my:Value="SingleResult"/>
		<my:Property my:Name="ObjectTypes" my:Value="Role"/>
		<my:Property my:Name="ColumnsToDisplay" my:Value="DisplayName"/>
		<my:Property my:Name="AttributesToSearch" my:Value="DisplayName"/>
		<my:Property my:Name="Filter" my:Value="/Role[SubType = '%Attribute_EmployeeType%']"/>
		<my:Property my:Name="ResultObjectType" my:Value="Role"/>
		<my:Property my:Name="Value" my:Value="{Binding Source=object, Path=Role, Mode=TwoWay}"/>
		<my:Property my:Name="ListViewTitle" my:Value="Available Roles"/>
		<my:Property my:Name="PreviewTitle" my:Value="Selected Roles"/>
		<my:Property my:Name="MainSearchScreenText" my:Value="Search"/>
	</my:Properties>
</my:Control>

The other thing I figured out is that it is possible to pass an attribute value in the UsageKeywords property. This is an alternative method to the for UocIdentityPicker and displays the Search Scopes that have the specifed Usage Keyword.

               <my:Property my:Name="UsageKeywords" my:Value="%Attribute_EmployeeType%"/>

Note: as pointed out by Eugene below this an Edit-RCDC function only as it uses the attribute value already committed to the object. We still wait in hope for a way to dynamically scope choices based on other values chosen in the current form…

4 Replies to “RCDC Variables, and using them to scope a ListView or IdentityPicker”

  1. just a small notice – it works fine in Edit mode. but it will not work 100% of time in Create mode when an attribute is empty.

  2. I would not even have attempted to use it in Create mode because, as you say, the attribute not having a committed value. But it’s a good point and I’ll update the post to mention it.

  3. I was actually thinking about that as I read the article so had a smile when I saw the comments.

    I suppose if you were going to do this, the ‘ideal’ way would be to have the filter attribute on a page in the RCDC BEFORE the picker/list, and to have the attribute as required. I might have a play to see if this actually works (though probably still not recommended)

    Also, probably a good idea to only use this against required attributes anyway.

  4. Hi Ross. If you mean you’d put the value on an earlier tab in the RCDC and then use it to filter in the same edit (or create) action – this won’t work. The value must already be committed to the object.

Leave a Reply

Your email address will not be published. Required fields are marked *


*