October 23, 2007

Prevent pasting documents into a view

Short tip today!
If you want to prevent documents from being pasted into a view, click on section 'Querypaste' for the view and type Continue=False in the sub routine.

Technorati tags:
, , ,


Kevin Pettitt said...

Thanks for reminding me that I really want a QueryPaste event at the db level. While you can do all sorts of manipulates with the querypaste event (not just blocking it), it is a royal PITA to have to add the code to every view.

The big problem that concerns me is when you put some sort of unique "key" field on a form (e.g. DocID = @Unique), and build a bunch of code around it. Then some clever user figures out they can "duplicate and customize" an existing document using copy/paste whenever they need a new one similar to an existing one. Of course, then your app breaks because the uniqueness of the DocID field is gone. Oh, and if you're using @DocumentUniqueID instead, and the field is computed when composed, the copy will now have a different UNID than the one stored in the field.

If you really need to, you can work around these problems by using the QueryPaste event in every view, but it would just be SO much easier and more foolproof to do so at the db level.

Niklas Waller said...

Hi Kevin,
Couldn't agree more to you!

Tommy Valand said...

While I haven't tested it, there is an event-type (on event) for agents that is somewhat along the lines of "When documents are being pasted".

Have you tested the limitations of those kinds of agents?

Niklas Waller said...

No I haven't. But that definately sounds like a possibility to perhaps control the pasting of documents for an entire database. Good thinking!