How to populate authors field in a document pasted from another database?

How can I populate an authors field in a document when it’s pasted into a database?

I have a database into which users (who are authors in the ACL to make use of the readers/authors security) copy/paste copies of documents from their mailbox. The documents then go through a workflow in this database, where they are populated with additional metadata fields by different people.

The problem I am having is that when users paste documents from their inbox, they are not being recognized as authors.

I currently have an agent that runs when documents are pasted and creates some additional fields, including populating a field with the current user, computing with form (authors field is computed), and saving. This works fine when managers and editors paste stuff, but when authors paste, it errors out on the Save method, saying “You cannot update or delete the document(s) since you are not listed as an allowable Author for this document.” The documents being pasted do not have authors fields in the users’ mailboxes from whence they are copied, so there are no authors fields when they get pasted. The form that they are using does have an authors field in my database, and stepping through the debugger in the on-paste agent, I can see that both the contents of the authors field on my form as well as the Authors property of the document itself contain the correct value(s) including that of the current user. Expanding the field properties shows ISAUTHORS = True. But the NotesDocument.Save function doesn’t seem to notice.

So far I have tried…

  • Making my authors field editable, computed, and computed when composed

  • Hardcoding “*” as well as specific user names into the authors field on the form

  • Using ReplaceItemValue on my authors field (with both a string and an array) and setting .isAuthors = true

  • Creating a new notesitem(doc, “Authors”, Session.Username, AUTHORS)

  • Both full and abbreviated user names

  • RemoveItem “FROM” (see below)

  • Creating a new document, using CopyAllItems from the pasted document to the new document, then deleting the pasted document

(The CopyAllItems approach halfway works… authors can edit the new document just fine, but my script fails to delete the pasted document because it doesn’t think they’re an author, so you end up with a duplicate that can’t be edited or deleted)

Despite the NotesDocument.Authors() field showing the current user on the original document from lotusscript, I found this unsettling bit of information on IBM’s site for the @Authors formula language version at http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_AUTHOR.html – it says that if there is no authors field, @Authors will try to use the From field.

I suspect that may be what’s happening here, so if they get an email from Joseph Schmoe, copy it from their own inbox and paste it into this database, Notes is using that logic to default the author to Joseph Schmoe (instead of the owner of the inbox from which it was copied). Thus, since users are only authors in my database (instead of editors/managers like they are in their mailboxes), neither they nor my when-documents-are-pasted agent are able to make changes… including populating the authors field with a value.

There doesn’t appear to be any way to programmatically access pasted documents except for when-documents-are-pasted agents, and those run after the documents have already been created in the database. Thus, I can’t use the CopyAllItems approach in, say, a querypaste event and then cancel the paste because the pre-pasted document collection isn’t available yet. And once the documents are pasted, I can’t delete them (manually or programmatically) because they didn’t have an authors field in their source database. Am I missing something?

Subject: This should be in the 8.5 forum

Apologies… I meant to post this in the 8.5 forum