Restrict Deletion of Attachment

Dear All

I have rich text filed named PRDOC to attach documents and I used the following code to attach document in it.

@Command([EditGotoField];“PRDOC”);

@Command([EditInsertFileAttachment]);

Now I want that user only can attach new documents but should not be allowed to delete old attach documents.

Or If user is allowed to delete a document then a log should be maintained.

Subject: Restrict Deletion of Attachment

I’d try using two RT fields - one which is visible if the user attaches a new file and another one which stores all attached files. in the QuerySave event an agent should transfer the freshly attached files to the second RT field.

For a deletion log you would have to monitor the embedded objects in the secon RT field. Simply make a list during QueryOpen and compare it to the remaining items during QuerySave to find the deleted files and write the names to a log field.

Subject: RE: Restrict Deletion of Attachment

I’ve successfully used a variant of this method in the past. Two RT fields, the first editable for adding new attachments and the second computed where all the attachments from the first RT field are moved at QuerySave. This required adding a mechanism for deleting attachments (by authorized users). This was implemented using an action (hidden for those without delete authority) which presented the user with a list of the attachments and then deleted the selected attachment via script methods.

Subject: A different take on the required functionality may work for you

Not sure about versions 7+ but for version 6 I had a similar situation

I found that if the user can edit the Rich Text field then they can detach the file

So I needed a method whereby the user could see the “attachments”

and yet not have (direct) access to the RTF

The key to the mechanism I built was to store the attachments not on the document itself but on separate small response documents

Of course that needed some work

  1. an attach file action

  2. a form for the carrir document (basically just an Rich Text Fiel)

  3. an embedded view to show the attachments on teh main form

  4. a detach file button

  5. a remove attachment button

but each of was relatively easy in Lotusscript

This structure allowed me to restrict the rights to

a) create “attachment”

b) extract attchment

c) delete attachment

separately to the right to edit the parent document

which was what I needed on this occassion

(logging was also pretty easy)

Hope this suggests a way forward for you