Ask the Expert

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]"
not
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.

This was first published in April 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: