Checking the UserRoles of a variable that is a User

Does anyone know how to determine the UserRoles of someone other than the current user?

I have a form that has a submit button that prompts for the next recipient from a list. Based on the selection I need to set the value of fields based on the UserRoles of the next recipient. I.e. Some forms need Executive approval and some can go directly to Technical Support.

I need something like this:

@If(variablex @IsMember(“[SA]”;@UserRoles);@Set(variable1;“1”);@Set(variable2;“2”))

Any help is appreciated.

Subject: Check “QueryAccessRoles” method in LS (RE: Checking the UserRoles of a variable that is a User)

Hi

Check the QueryAccessRoles method in LS. It returns the roles of a person, group or server in a database.

Don’t know if LS would fit with the rest of the document you are creating, but it’s the only quick idea i have atm.

HTH

andyG

Subject: RE: Check “QueryAccessRoles” method in LS (Checking the UserRoles of a variable that is a User)

Thanks for the quick suggestion.

I do not know LotusScript so is there as way with the Formula language?

Regards.

Subject: RE: Check “QueryAccessRoles” method in LS (Checking the UserRoles of a variable that is a User)

Hi again

I don’t know of any way to do this in formula language, but it’s not to difficult with LS.

I’m assuming a notes client is being used, so set the “Exiting” on your field where you select the user name with the following script:

Sub Exiting(Source As Field)

'declaring variables

Dim session As New NotesSession

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace

Dim docui As NotesUIDocument

'set the database

Set db = session.CurrentDatabase

'get a handle to the ui document

Set docui = ws.CurrentDocument

'get the name entered into the field “userSelect”

uName = docui.FieldGetText( “userSelect” )

'get the roles for that name

roles = db.QueryAccessRoles( uName )

'test if no roles,

If roles(0) = “” Then

msg = “No Roles”

Else

'else we have some roles so test them

Forall role In roles

msg = msg + role + Chr(10)

'or we can test for the role, and set a field value

If role = “[Admin]” Then

Call docui.fieldsettext( “varField1”, “1” )

End If

End Forall

End If

'set a field to display the string of roles.

Call docui.FieldSetText( “userRole”, msg )

End Sub

This was quickly done with field ‘userSelect’ as your selection field. ‘varfield1’ as a field to set a variable in. And ‘userRole’ as a computed text field, just to display the roles in testing mode. Using the ‘exiting’ event triggers the code to run when leaving the field.

HTH

andy G