Add a Role in Formula

Posted on 2009-12-26
Last Modified: 2013-12-18

I am tweaking a form that has a field called "CurrentEditor" which provides a list of names that will add the names as editors on the document.  I would like to have a role set for all documents to add a specific group as editors to all documents.  The code below is on an "Edit Button" which will allow all authors of their own documents, to see and edit the document (by way of author field) but I need to add the new field DocumentAuthors in which the role "[EditRights]" has been applied so they can see this button as well -- if they are not the authors of the document. (this app is only for notes client -- so the $RefOptions can be ignored)

!(@LowerCase(@Name([CN]; @UserName)) = @LowerCase(@Name([CN]; From) : @LowerCase(@Name([CN]; CurrentEditor)))) | (@IsAvailable($RefOptions))
Question by:AliciaVee
    LVL 46

    Expert Comment

    by:Sjef Bosman
    Errrrr... don't understand. Can you explain again, maybe with an example? Can you include the Reader and Author fields? What do you want to achieve?

    I get the idea that you're trying to do something that is technically possible yet rather dangerous. If your goal is to "allow authors of their own documents to see and edit the document", and you mean to do that by role, I have to warn you that  that won't work. Once you add the role as an Author to a document, ANY person with that role will be able to see and edit ANY document with that role.

    I hope I got it wrong...

    Author Comment

    Sjef -- sorry I wasn't clear.  Let me explain:

    There are 2  fields to control author/edits in this database as follows:
    from -  author field with computed as composed with @username
    documentauthors - author field with computred with role called [EditRights]

    in access control list:
    AuthorGroup - access type: author - and should add and edit their own docs)
    ReadGroup - access type: reader - will only be able to read documents
    EditGroup - access type: author- will have the role of EditRights applied

    Problem to solve: do not let readers see the "Edit Button" on the documents or the "Add Document" button on views

    Maybe there is a simplier way?
    LVL 46

    Accepted Solution

    Users who are supposed to see the Edit button:
    - users with the EditRights role
    - users without the role but who are Author of the document and at least Author in the ACL

    As for the Edit-button: it is not possible in a view, since the visibility is evaluated only once, and not when you move up and down in the view. In the form, the hide-when formula could be:
          !@IsMember("[EditRights]"; @UserRoles) & !(@UserAccess(@DbName)>=3)

    The formula isn't complete, but there is no (easy) way to test whether the current user can edit a document.

    For the Add Document button: any person with Author rights or better can add documents. Code in the hide-when:

    Author Comment


    Okay -- your comments got me thinking and I now understand.  I used the following to hide the edit button if the person, who has the EditRights role is also the author of the document:
    !@Contains(@UserRoles; "[EditRights]" ) & (From != @UserName) ==> and so if the person isn't the author -- but has the edit role -- they will see this edit button, but not the other edit button that is visible to all authors of their own documents:
    !(@LowerCase(@Name([CN]; @UserName)) = @LowerCase(@Name([CN]; From)))
    (this was in the application -- so I am leaving it and adding a new button)

    For views, I kept the following on the "add document" button -- which should work since I have an "authors" role in the acl and both authors group and editors group will have this role applied:

    So, I think I'm set -- not the most elequent -- but works!



    Author Closing Comment

    Appreciate the response, feedback and dialogue

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now