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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.