Sun Java System Identity Manager - getMap call from rule library problem

can anybody help me ,why this code is unable to get map values into drop down box?

I have a drop down menu, which has to display few values depending on the requestors role in the organization.

<Field name='user.accounts[Lighthouse].employeeType'>

<Display class='Select' action="true">

<Property name='title' value='Account Type:'/> </Display>

<Expansion>

<switch>

<ref>user.accounts[Lighthouse].adminRoles</ref>

<case>

admin

<call name= 'Rule Library:getAdminType'/>

</case>

<case>

HR

<call name='Rule Library:getHRType'/>

</case>

</switch>

</Expansion>

</Field>

[807 byte] By [G_identitya] at [2007-11-26 23:08:38]
# 1

Your problem maybe is that the tag <switch> represents a control statement instead of a method that returns a value.

You can define a variable and assign the desired value according to your business logic and then return it as a list of values in order that the field can display it.

The program would looks similar to:

<Field name='user.accounts[Lighthouse].employeeType'>

<Expansion>

<block>

<defvar name='something/>

<switch>

<ref>user.accounts[Lighthouse].adminRoles</ref>

<case>

<s>admin</s>

<set name='something'>

<call name= 'Rule Library:getAdminType'/>

</set>

</case>

...

<ref>something</ref>

</block>

you can debug the form, and after expansion executes, the value of variable "something" must be a valid value for a Select type field.

I hope it helps you

hjuareza at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 2

Thanks for your response. I did use the same code as suggested and and Display class property. I was able to see the field but not the values. The drop down is empty though.

Am I missing anything here? I am checking the role of the requestor( account who runs the create user workflow) and depending on his role we have to assign what type of employee's he/she can create.

By the way, where should the </Display> should end. Should the <Expansion> be in <Display>?

<Field name='user.accounts[Lighthouse].employeeType'>

<Display class='Select'>

<Property name='title' value='Account Type'/> </Display>

<Expansion>

<block>

<defvar name='AccountMap'><null/></defvar>

<switch>

<ref>requestorView.accounts[Lighthouse].adminRoles</ref>

<case>

admin

<set name='AccountMap'>

<call name='Rule Library:getCTRtype'/>

</set>

</case>

<case>

Administrative Contact

<set name='AccountMap'>

<call name='Rule Library:getOthersType'/>

</set>

</case>

</switch>

<ref>OtherMap</ref>

</block>

</Expansion>

</Field>

G_identitya at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 3

A Select field displays the values that you configure in the property allowedValues, an example:

<Field name='abc'>

<Display class='Select'>

<Property name='title' value='abc'/>

<Property name='nullLabel' value='Select...'/>

<Property name='valueMap'>

...put code that returns a list of values.

</Property>

</Display>

</Field>

hjuareza at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 4

we cannot put <expansion> in a property.

getting error: The content of element type "Property " does not match.

Code:

<Field name='user.accounts[Lighthouse].employeeType'>

<Display class='Select' action="true">

<Property name='title' value='Account Type:'/>

<Property name='valueMap'>

<!-- logic for evaluating which map to call>

<Expansion>

<block>

<defvar name='AccountMap'><null/></defvar>

<switch>

<ref>requestorView.accounts[Lighthouse].adminRoles</ref>

<case>

admin

<set name='AccountMap'>

<call name='Rule Library:getCTRtype'/>

</set>

</case>

<case>

Administrative Contact

<set name='AccountMap'>

<call name='Rule Library:getOthersType'/>

</set>

</case>

</switch>

<ref>AccountMap</ref>

</block>

</Expansion>

</Property>

<Property name='required'>

<Boolean>true</Boolean>

</Property>

<Property name='nullLabel' value='-- Account Type--'/>

</Display>

</Field>

G_identitya at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 5

Yes, you cannot put an expansion in a property, but it is not the desired behavior. I think you are mixing both concepts, calculating the values to be displayed in the form and the value of the field itself.

You want to put values to be displayed to the end user in the valueMap (map) or allowedvalues(list) property and then optionally put an Expansion tag that obtains the final value of the field, of course, only one of the values contained in the valuemap or allowedValues properties.

hjuareza at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 6

Here is the case.

I have 3 users with different roles in a organization, who runs create user workflow.

User1, HR can create only contractor(types) in the organization

User2,3, Admin1 and Admin2 can create employees,contractors, Interns and fellows(types) in the organization.

Now, evaulating who inititated the work flow, I want to give these user's appropriate valueMap in their Select field.

The valueMap is of the form: ccontractor.......

This field subsequently alters other fields display, as well....

Right now I have valueMap for 3 users to create all types.But, want

to make HR to create only one type(contractor).

But just want to see HR will get only one value in its Select dropdown.

Can you please point me where I am going wrong?.

Thankyou

G

G_identitya at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...
# 7

Now, evaulating who inititated the work flow, I want

to give these user's appropriate valueMap in their

Select field.

The valueMap is of the form:

ccontractor.......

This field subsequently alters other fields display,

as well....

As I have told you, you can fill the valueMap property so that you can display the correct Options on the Select field. You can put that logic in a rule that retuns a key-value map. That rule will receive all the criterias that help you to decide what are the options to be displayed.

You can define a Null value if you want the HR user always click the field and then it executes an Action so that you can fill other fields, and it won't matter if the field has just one value.

hjuareza at 2007-7-10 14:03:23 > top of Java-index,Web & Directory Servers,Directory Servers...