Stopping Copy and Paste, in Lotus Notes

( Time)

It is very useful for many kinds of Lotus Notes applications (like work flows), to stop users from being able to copy and paste a document into a database application. In R5 a new kind of Agent was introduced, trigger on the Run option ” “If Documents Have Been Pasted”.

from there it’s a little formalu language :

1
2
3
SELECT @All;
@DeleteDocument;
@Prompt([OK];"No pasting Allowed";"Pasting documents into this database is not allowed. Action is cancelled.")

If you what to selectivity allow some documents to be pasted in add a line before the @DeleteDocument

1
2
3
4
SELECT @All;
@if(Form="requestForm";@return("");"");
@DeleteDocument;
@Prompt([OK];"No pasting Allowed";"Pasting documents into this database is not allowed. Action is cancelled.")

Either way you can save your self from getting all kinds of junk documents in your database and views.

3 Replies to “Stopping Copy and Paste, in Lotus Notes”

  1. You can also make use of the QueryPaste event in the views with something as simple as

    Sub Querypaste(Source As Notesuiview, Continue As Variant)
    continue = False
    End Sub

    adding a messagebox if you want. That way, if desired, you can limit pasting to specific views (such as an administrators only view for admins who are allowed to paste documents).

  2. Good Point Christopher, esp for Admin/Dev only views and docs, because I’m always doing that sort of thing to short cut the work involved! And its worth remembering those view level events.

    However, doing so for each view is such a pain, Although less so if you have planed things upfront and create all your ongoing views off a well built “template” view, but than that rarely seems to happen (to me).

    So, for me, having one place to control this action at the Database level is the way to go, and since there is no Database script QueryPaste event, using the Agent was the ticket.

    It occurs to me adding a line before the @DeleteDocument; like :

    @If (@Contains(@UserRoles;”UberDev” );@Return(“”);””);

    would allow those in the UberDev role to bypass the “Stopping Copy and Paste” agent.

    Whether that is a good idea is another question.

  3. Formula above prompts multiple times when more than 1 document is pasted. To avoid this, the code in the agent can be changed to Lotus script

    Dim sess As New notessession
    Dim db As notesdatabase
    Set db = sess.CurrentDatabase
    Msgbox “Pasting documents into this database is not allowed. Action is cancelled.”
    Call db.UnprocessedDocuments.RemoveAll(True)

    Ian : Good point and nice fix!

Leave a Reply