Add role

Hi everybody,

I have a database that has a profile document.

I want to set up new users and add a specified role automatically and save ACL.

I have this code but something is wrong and I cannot figure it out.

Dim db As notesdatabase

Set db =session.currentdatabase

Dim acl As NotesACL

Dim entry As NotesACLEntry

Set acl = db.ACL

Set entry = acl.GetEntry( “Field name” )

Call entry.EnableRole( “Role name” )

Call acl.Save

What is wrong?

Subject: field name

what is field name in this line: Set entry = acl.GetEntry( “Field name” )

I am assuming you are getting the user’s name from a field on a document? If so you need a few more declarations so your code can get to the field value.

Subject: add role.

yes, this is what I do.I don’t undestand why it cannot retrieve the field value.

Call entry.EnableRole( “field name” )

Subject: get doc and use doc.fieldname(0)

I think what Paul is trying to get at, is that you need to try adding something like this:

dim doc as notesdocument

set doc = session.documentcontext

Set entry = acl.GetEntry( doc.fieldname(0) )

Subject: you are correct