Stop editors from sending a document to EditMode

Hi Experts,

I have a document that I don't want people to be able to edit by double clicking or going to actions/edit
But I do want it to goto edit only if they press a special action button.

The only problem is the action button has code and it is all in formula, and the QueryModeChange also has code already
but its all in script.  Is there a way I can stop the user from editing unless they press this Action button (in formula)

Thanks in advance... Joe.
jpirozzoloAsked:
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.

ZvonkoSystems architectCommented:
You can not stop editing, but you can avoid changing the document :)

Add a field named SaveOptions and set it to "0"

Now your button should change this field to "1" before saving. Otherwise are people editing this document without button doing this in vain.

0
ArunkumarCommented:
Have an action button on view called as edit document.

Have this code:
@SetEnvironment( "EditAccess" ; "1");
@PostedCommand( [EditDocument] ; 1 )

In the QueryOpen Event have this script
-----------------
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
'    To check the document status:    
'    If the user opens the document in Read Mode , allow him to do so
'    If the user opens the document in Edit Mode without clicking the 'Change Name' Button, stop him
'    If the user clicks the 'Change Name' button then allow him to modify the contents
     
     Set Session = New NotesSession
     EditAccess = Session.GetEnvironmentString("EditAccess")
     If Mode = 1 And EditAccess <> "1" And (Not Isnewdoc) Then
          Continue = False
     End If
End Sub
------------

in the query modechange event have the following...

------------
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
' The environment vairable EditAccess is set when the user clicks the Change Name button on the view Action Bar to 1, indicating that
' the user can edit the document to change the manager's info.  If the user did not use the Change Name button, do not allow them
' to edit the document since the agents would not run that make the changes to documents in other databases.
     
     Set Session = New NotesSession
     EditAccess = Session.GetEnvironmentString("EditAccess")
     If Not (Source.EditMode And EditAccess = "1" ) Then
          Continue = False
     End If
     
End Sub
-------------------
In query Close have this formula,

--------------------
ENVIRONMENT EditAccess := "0";
""
----------------

-Arun.
0

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
ArunkumarCommented:
Zvo-Bro !
This one is mine. And Joe will be definitely giving me 500 pts with EXcellent grading just wait and see...
:-)

0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

ZvonkoSystems architectCommented:
OK :)

But read first his requirements: no change in QueryModeChange section.
He use @formula and you propose LotusScript.

But if you mange to get the points, then it is ok :)

0
ArunkumarCommented:
Hee Hee Hee.... I am lucky here too...

The button of mine has formula and the mode change event has script.

It will be easy for him to implement my solution...

:-)
0
jpirozzoloAuthor Commented:
Thanks guys for the quick responce.
Looks like Arun gets the gold medel on this one (sorry Zvonko).. Perfect combo of Script and formula.

Anyway thanks again and have a great weekend.

Well done ... Joe :-D  
0
ArunkumarCommented:
FYKI: That code was stolen from none other than the #1.

:-)
Arun.
0
jpirozzoloAuthor Commented:
Oh yes!! so it was.

Well as CRAK says better stolen well than programmed badly :D
0
ArunkumarCommented:
oh yea!
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.