Link to home
Start Free TrialLog in
Avatar of Jaziar
Jaziar

asked on

Can you get the UserName From The Role?

Using Qwaletee suggestion.  I am sure you can see how this works.  Can we make this work in reverse.
I would like a button named Pick Role -> The form underneath has a field that displays the Roles in the ACL or could even look for a specific Role - Example The button would be named Pick DE Role and then the field would be populated with users assigned to the Role DE?  Right now we pick the name and then we get the role, I need to pick the role and get the names.  I really like the way Qwaletee set this up, so I would like to continue with it.

First, add a field to the form called NameFromACL, computed when composed, value ""
Second, add a field called RolesForACLName, allow multiple values, computed when composed, value ""
Third, add a button labeled "ACL Roles" with the following formula:
@DialogBox("ACLRolePicker")

Next, create a subform.  Copy the same two fields to the subform.
Change the first field (NameFromACL) to type Dialog List, choices frmo ACL, enable refresh fields on keyword change.
Hide the second field.
Then, put the following code in the QueryClose of the subform:
    source.Document.ReplaceItemValue "RolesForACLName" , source.Document.parentDatabase.acl.getEntry(Source.FieldGetText("NameFromACL")).roles
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jaziar
Jaziar

ASKER

OK I am getting the SubForm Opened and the List of Roles show up.  In the dialog box I can select ex: [DE] and hit enter.  I then get the error

Notes Error:  Can not locate field
Avatar of Jaziar

ASKER

I did make ListOfRoles allow Mulitple Values so the selection could just be one Role and not all of them as a string
Avatar of Jaziar

ASKER

I fixed the problem - thank you very much
Avatar of Jaziar

ASKER

One last thing is there a way to do a @Name([cn]) on the field in the main form that is displaying the name?
Yes.  Any fields with the same name on the main and subforms will "sahre data."  In addition, any other fields on the main form can be used in formulas in the subform.