andyhines
asked on
CopyAllItems causing problem with permissions
Hi,
It's been a while since I posted in here but I have an odd problem that I'm hoping someone can help me with.
I have a function in a script library which creates a new copy of my existing document. The document is a person record in an HR system and in the event that their position changes I want to create an archive copy of their old HR document.
Although the code works the new document can't be read or even seen by me. I can see it if I run Notes on the server and access the database that way. I do have Readers and Authors fields on the original document (Employee) and the archived copy (Employee Position). These fields still exist on the EP document and look to be correct but in fact their type has changed from Text List to Text.
Why does this happen ? What's the best way to copy a multivalue Authors field from one document to another ?
Code to do the copy is here:
Public Function CreateEPR As Integer
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim currentdoc As NotesDocument
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
Set uidoc = workspace.CurrentDocument
Set currentdoc = uidoc.Document
currentdoc.CopyAllItems doc, False
doc.Form="Employee Position"
Call doc.Save (True,True)
End Function
Original-doc.PNG
It's been a while since I posted in here but I have an odd problem that I'm hoping someone can help me with.
I have a function in a script library which creates a new copy of my existing document. The document is a person record in an HR system and in the event that their position changes I want to create an archive copy of their old HR document.
Although the code works the new document can't be read or even seen by me. I can see it if I run Notes on the server and access the database that way. I do have Readers and Authors fields on the original document (Employee) and the archived copy (Employee Position). These fields still exist on the EP document and look to be correct but in fact their type has changed from Text List to Text.
Why does this happen ? What's the best way to copy a multivalue Authors field from one document to another ?
Code to do the copy is here:
Public Function CreateEPR As Integer
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim currentdoc As NotesDocument
Dim db As NotesDatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
Set uidoc = workspace.CurrentDocument
Set currentdoc = uidoc.Document
currentdoc.CopyAllItems doc, False
doc.Form="Employee Position"
Call doc.Save (True,True)
End Function
Original-doc.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AFAIK you did nothing wrong. Sometimes Notes does just a bit weird... but most of the times it behaves nicely. I still prefer (Notes and) Domino, and XPages these days does a great job. Integration-wise they are still miles ahead of the competition, IMHO. But that's just My HO...
ASKER
That works perfectly.
Is this a known problem or wasI just trying to use it wrongly.
Regards - Andy