I am unable to see what the problem with this script. The error message states "Not a member of GETFIRSTITEM". I don't know what this means or the correct way to rectify it. Any help or guidance would be immensely appreciated :)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim Additional_1 As NotesRichTextItem
Set uidoc = workspace.CurrentDocument
Set Additional_1 = uidoc.GetFirstItem ("Additional_1")
Call Additional_1.CopyItemToDocument (uidoc, "Additional")
Call uidoc.Save (True)
Subject: Not a member of GETFIRSTITEM
GetFirstItem is a NotesDocument method and you are using a NotesUIDocument
It seems that you are trying to take a NotesRichTextItem and copy it to another one on the same document. Why?! You can’t do this with UI methods.
Try something like this
Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Dim doc as NotesDocument
Dim rtItem as NotesRichTextItem
Set uidoc=ws.currentDocument
If uidoc.isNewDoc then
Call uidoc.save
End if
'Get the NotesDocument
Set doc=uidoc.document
Set rtItem=doc.getFirstItem(“Additional_1”)
Call rtItem.CopyItemtoDocument(doc,“Additional”)
Call doc.Save(True,False,True)
============
To see the changes in the front end you will need to close and reopen the uidoc
Subject: RE: Not a member of GETFIRSTITEM
This script is used as an agent to be executed on documents whose form had a richtext field named “Additional_1” created in error. I need to copy the contents of “Additional_1” to “Additional” (the field has already been added to the affected documents). Once that is done I can delete the "Additional_1’ field from the affected form and documents.
The script that was suggested, does not do that for me. Is this an impossible task
Subject: RE: Not a member of GETFIRSTITEM
It is not impossible at all, it just isn’t a font-end task. You just need an agent which is something like:
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim Additional_1 As NotesRichTextItem
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
If collection.Count = 0 Then Exit Sub
Set doc = collection.GetFirstDocument
While Not (doc is Nothing)
Set Additional_1 = doc.GetFirstItem ("Additional_1")
Call Additional_1.CopyItemToDocument (doc, "Additional")
Call doc.Save (True, False)
Set doc = collection.GetNextDocument(doc)
Wend
and is set to run on selected documents
Subject: RE: Not a member of GETFIRSTITEM
Not it not impossible,
change the script so that you have a document collection and use that as in.
set dc = dB.unpcoessedDocuments
set doc = dc.getFirstDocument
while not ( doc is nothing)
do your copy
set doc = dc.getNextDocument( doc)
when
John