[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1351
  • Last Modified:

How do I lock-down fields in Domino Designer so they can not be edited by a Lotus Notes client?

Typically, our databases were created with the following Lotus Script in the Querymodechange:

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
      Dim doc As notesdocument
      Dim session As New notessession
      Set doc=source.document
      If(doc.GetItemValue("status")(0) <>"Draft" And "Sue Smith" <> session.CommonUserName) Then
            Messagebox "Once submitted this document cannot be edited.", 64, "Help"
      End If
End Sub

Although I am not saavy or experienced enough to know exactly how to write Lotus Script, I do know that this code locks down a form so that a user can not edit it once it leaves draft. However, an administrator like Sue Smith can.

I'd like to take this down to the field level so that instead of locking down the whole form,  I can lock down some fields, but leave others open for editing - such as the field that allows for attachments. Although we do not want the document edited once submitted, we do still want the user to be able to attach additional documentation.

Any suggestions would be much appreciated.
1 Solution
For the fields which you want to make non-editable, you can create computed fields and use hide-when formulae based on the Status condition.
Like Status!="Draft"
And if you change the code to this, anyone can edit:
' If(doc.GetItemValue("status")(0) <>"Draft" And "Sue Smith" <> session.CommonUserName) Then 'Old code
If(doc.GetItemValue("status")(0) <>"Draft") Then 'New code.
Since version 6 there is a new field formula, you used only have "default value or Input Transalation or Input Validation formulas", now you get "Input Enabled" it uses also formula and works the same the answer of the formula must just be @True or @False for example if want to check your field Status value then just put a formula for example Status != "Closed" which will either calculate to True or False. There is more examples in the Designer help. Very easy and simple
Sjef BosmanGroupware ConsultantCommented:
I'd suggest not to go to the field level with lots of formula and potentially more maintenance issues.

There are at least 3 (better?) ways to address this:
a) use a controlled access section, which requires one formula for many fields; this has to be developed and activated at design time, meaning that, if you change it now, existing documents will not be adapted automatically.
b) use a dialog box if you want to adapt only a few fields in the document
c) use a different form, and a Form formula in the view; it's somewhat tricky but it might work; essentially it's the same as b)
In all solutions above except one, an end user could write a simple agent to change field values to whatever they want.  If that is a concern, then the only option is the controlled access section.
fselliottAuthor Commented:
This was the best solution for my purposes

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now