Problem solve Get help with specific problems with your technologies, process and projects.

How can I make fields editable by some users, but not by others?

Hi, I am an absolute novice at Notes dev, so please bear with me. We have a little system in which fields are filled in and then the form is "sent" to someone else for approval. The fields are set as text editable, but then when the next person views the document, the info needs to be seen but not editable. Thanks for any help.
There are many ways to do this. Here's an often-used method that I usually prefer.

Place the fields that you want to be conditionally editable inside of an access-controlled section. The section editors formula can use the fields on the form and information about the user to calculate whether the person viewing the document is allowed to edit the document.

For instance, let's suppose that you want to only allow the user who submitted the form to edit these fields, and then only until the form is submitted. You have a field named Submitter, Computed When Composed that contains the Notes name of the user who composed the form (formula: @UserName). Another field, Status, tells whether the document has been submitted or approved. It has four possible values: Draft, Submitted, Approved or Rejected. If the form is in Draft or Rejected status, the submitting user may edit the fields; if not, no one may edit them.

In this case, you could select the type of the section editors formula as "Computed for display" so that it will be recalculated every time the document is opened. The formula could be:

@If(Status = "Draft" : "Rejected"; 
Submitter; "-nobody-") 
In other words, if the status is Draft or Rejected, the person whose name is in the Submitter field may exit here; otherwise, nobody can. (There is nothing special about the value -nobody- -- you can use any string that you know doesn't match the name of any user or group). If the formula returns "" or "*", anybody can edit that section.

Section editor formulas often return a role name such as "[Admin]" instead of or in addition to a username. Remember if you are using multiple values, to create a list using the ":" operator, not "+". For example:

Submitter : "[Admin]"
Submitter + "[Admin]" 
to allow the submitter and everyone in the [Admin] role to edit.

One caveat: Controlled access sections are not a security feature. A determined and knowledgeable user can change the value of any field in any document that they have access to edit. If you need to be certain that only certain users can change the document, use Authors fields to limit access to certain users.

If you don't want the expand/collapse the functionality of a section, set the section to be expanded in all modes, and use the hide tab of the section properties to hide the section header. This has the effect of locking it open. (The hide properties in the section dialog apply only to the header line, not to the section contents, but if the header is hidden the user has no way to open the section.)

Do you have comments on this Ask the Expert Q&A? Let us know.

Dig Deeper on Lotus Notes Domino Formula Language

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury