Accessing List of users with a specific role for field entry choice

I’m attempting to create a picklist / names field prompt from which a user may choose an individual to send a purchase order for approval purposes. The picklist will populate the field (“GM”) which eventually populates the SendTo field that will be used to notify them of the purchase order in need of approval.

I would like the picklist to pull from only one specific role within the ACL (there are currently two roles available – “Manager” and “GM”, the “GM” being the final approver role from which I would like that picklist to be populated).

Currently, it seems I can only retrieve the full ACL to populate a list of choices (using Choices within Field Properties), which includes all of the mid-level approval roles as well.

Is there any way that I can pull a list of individuals in a specific role (and, if so, can those full addresses be trunkuated using the [CN] attribute for easy viewing?)?

Thanks & Regards,

Tom Haller

Subject: Accessing List of users with a specific role for field entry choice

All I can think of (perhaps someone else has a better, easy solution) is building the list in a field using LotusScript written in PostOpen.

First you’d have to loop through every entry in the ACL and check IsRoleEnabled, building an array of all entries with that role.

Then you’d have to determine which of those entries are group names, and read the members from the group document in the NAB, recursively expanding any embedded group names and then retrieving their members.

Seems like a valid argument for creating Groups in the NAB for these roles, so that the choice list can be populated from the group doc instead of from the ACL.

Subject: Accessing List of users with a specific role for field entry choice

You might be able to do this with LotusScript and two fields (maybe one, but I don’t have time to test any of this). Create a separate, hidden multivalue field. Set the value of the picklist field to the multivalue field name, then in your queryopen or postopen, loop through the ACL. As you loop to each NotesACLEntry, get the Roles of it. If the role you want is listed, add the name to the multivalue field.

In pseudocode:

QueryOpen

Get acl

Set entry as first entry

while not entry is nothing

get roles

  if desiredRole is in roles

      add acl entry's name to multi field

  end if

move on to next acl entry

Subject: RE: Accessing List of users with a specific role for field entry choice

Thanks to both of you for responding so quickly.I’ve been working on some of the suggestions and think I’ve found the solution through the suggested multiple fields.

Step 1:

Create two unique, hidden fields (PeopleGM & PeopleApprover) that will eventually be used to populate dialoge boxes for choice selection (in step 3).

Step 2:

Create PostOpen script for Form which will populate those two unique fields (step 1) with the names associated with each of the respective roles (each unique field then represents the subset of ACL entries that have the particular role assigned). Script follows:

Sub Postopen(Source As Notesuidocument)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim session As New NotesSession

Dim db As NotesDatabase

Dim acl As NotesACL

Dim entry As NotesACLEntry

Dim roleName As String

Dim foundRole As Variant 

Set uidoc = workspace.CurrentDocument

Set db = session.CurrentDatabase

Set acl = db.ACL

roleName = "[GM]"

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

	If entry.IsRoleEnabled( roleName ) Then

	Call uidoc.FieldAppendText _

	( "PeopleGM", entry.Name & ";" )

	End If

	Set entry = acl.GetNextEntry( entry )

Wend



role2Name = "[Approver]"

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

	If entry.IsRoleEnabled( role2Name ) Then

	Call uidoc.FieldAppendText _

	( "PeopleApprover", entry.Name & ";" )

	End If

	Set entry = acl.GetNextEntry( entry )

Wend

End Sub

Step 3:

Create 2 DialogBoxes forms (PickGM and PickApprover)-- one for each field. Each dialog box contains list box field which provides only choices that pull from the unique fields established in step one.

Step 4: GM and Approver fields in Dialog boxes are linked to the two fields (GM and Approver) in the main form, which I originally wanted to pull from the ACD, and populate the main form when the selection is made.

The result is a dialog box that opens for the “GM” choice field with a list of individuals in the ACL with role “GM”. The other result is a dialog box that opens for the “Approver” choice field with a list of individuals in the ACL with role “Approver”.

Thanks again for your help!!

Subject: Accessing List of users with a specific role for field entry choice

Thanks to both of you for responding so quickly.I’ve been working on some of the suggestions and think I’ve found the solution through the suggested multiple fields.

Step 1:

Create two unique, hidden fields (PeopleGM & PeopleApprover) that will eventually be used to populate dialoge boxes for choice selection (in step 3).

Step 2:

Create PostOpen script for Form which will populate those two unique fields (step 1) with the names associated with each of the respective roles (each unique field then represents the subset of ACL entries that have the particular role assigned). Script follows:

Sub Postopen(Source As Notesuidocument)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim session As New NotesSession

Dim db As NotesDatabase

Dim acl As NotesACL

Dim entry As NotesACLEntry

Dim roleName As String

Dim foundRole As Variant

Set uidoc = workspace.CurrentDocument

Set db = session.CurrentDatabase

Set acl = db.ACL

roleName = “[GM]”

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

If entry.IsRoleEnabled( roleName ) Then

Call uidoc.FieldAppendText _

( “PeopleGM”, entry.Name & “;” )

End If

Set entry = acl.GetNextEntry( entry )

Wend

role2Name = “[Approver]”

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

If entry.IsRoleEnabled( role2Name ) Then

Call uidoc.FieldAppendText _

( “PeopleApprover”, entry.Name & “;” )

End If

Set entry = acl.GetNextEntry( entry )

Wend

End Sub

Step 3:

Create 2 DialogBoxes forms (PickGM and PickApprover)-- one for each field. Each dialog box contains list box field which provides only choices that pull from the unique fields established in step one.

Step 4: GM and Approver fields in Dialog boxes are linked to the two fields (GM and Approver) in the main form, which I originally wanted to pull from the ACD, and populate the main form when the selection is made.

The result is a dialog box that opens for the “GM” choice field with a list of individuals in the ACL with role “GM”. The other result is a dialog box that opens for the “Approver” choice field with a list of individuals in the ACL with role “Approver”.

Thanks again for your help!!

Tom Haller