Derivation Field
I have a form where I have a text box to enter the UID of other users.
Now firstly I want to validate whether the UID is present in the IdM. For which I can invoke a java method.
Secondly I want to display user's email in next field (as derivation), but I am not getting that.
e.g. The first Field name is OtherId where UID will be entered.
On next field in Derivation I am using<ref>OtherID.email</ref>
Please let me know if this can work or how to display OtherID's email address? Shall I use other java method to retrieve those valuses from resource ? or what's best option to solve both of these cases?
[668 byte] By [
IdmUser] at [2007-11-26 9:38:06]

# 1
You would first need to call getObject FormUtil method to get the user object corresponding to the id. Then call
<get>
<ref>userObj</ref>
<s>email</s>
</get>
to get the email id. You would need to execute the getObject method with sufficient permissions to fetch a user object.
# 2
Below is the one I tried but didn't work -
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>:dispay.session</ref>
<s>User</s>
<ref>Accounts[Lighthouse].OtherId</ref>
</invoke>
<get>
<ref>UserObj</ref>
<s>lastname</s>
</get>
# 4
I tried this way also but it returns 'lastname' string only not the value of lastname from IdM.
<block>
<set>
<s>UserObj</s>
<s>lastname</s>
</set>
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>:dispay.session</ref>
<s>User</s>
<ref>Account[Lighthouse].OtherId</ref>
</invoke>
<ref>UserObj</ref>
<s>lastname</s>
</block>
# 5
Try this definately it'll work.
<invoke name="getAttribute">
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>:display.session</ref>
<s>User</s>
<ref>accountId</ref>
</invoke>
<s>email</s>
</invoke>
# 6
The set is incorrect. The right code would be
<block>
<set name='UserObj'>
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>:dispay.session</ref>
<s>User</s>
<ref>Accounts[Lighthouse].OtherId</ref>
</invoke>
</set>
<get>
<ref>UserObj</ref>
<s>lastname</s>
</get>
</block>
# 7
Thanks, When I used the sample code, I get this error -
XPRESS exception ==> com.waveset.util.WavesetException: Can't call method getObject on class com.waveset.ui.FormUtil ==> com.waveset.util.WSAuthorizationException: View access denied to Subject T004 on User: T002.
I checked up the forum and it points to use runasuser but that is all respective to rules. Can anybody tell how can I use <runAsUser> in the derivation field of form and where exactly shall I use this in sample code? Or if there is other method to eliminate this problem.
# 8
This is how i have done it..... I have a rule with the getObject call
<Rule name='getUserObject'>
<RuleArgument name='userId'/>
<RunAsUser>
<ObjectRef type='User' id='#ID#Configurator' name='Configurator'/>
</RunAsUser>
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>context</ref>
<s>User</s>
<ref>userId</ref>
</invoke>
</Rule>
and in the form i have
<get>
<rule name='MyLibrary:getUserObject'>
<argument name='userId' value='$(OtherID)'/>
</rule>
<s>email</s>
</get>