When I use the code below a get this message in my log.
“ERROR 4239: AppendDocLink requires a NotesDocument, NotesView or NotesDatabase argument”
'==================================
Set gLCNotesFieldList = New LCFieldList
With gLCNotesFieldList
Set gLCNReqNumDsp = .Lookup ("ReqNumDsp")
Set gLCNLocationDesc = .Lookup ("LocationDesc")
Set gLCNVendorNum = .Lookup ("VendorNum")
End With
Call gLCNotesCon.Fetch ( gLCNotesFieldList)
Dim ReceivingLogDoc As NotesDocument
Set ReceivingLogDoc = gLibCurrentDatabase.createDocument
With ReceivingLogDoc
.form = "frmReceivingLog"
.ReqNumDsp = gLCNReqNumDsp.Text(0)
.LocationDescDsp = gLCNLocationDesc.Text(0)
.VendorNum = gLCNVendorNum.Value(0)
Dim reqReqDocLink As NotesRichTextItem
Set reqReqDocLink = New NotesRichTextItem( ReceivingLogDoc, "ReqDocLink" )
Call reqReqDocLink.AppendDocLink( gLCNotesFieldList, "Requisition" )
Call ReceivingLogDoc.computewithform(False, False)
Call ReceivingLogDoc.save(True,True,True)
End With
An LCFieldList is metadata - it is neither a document, a view, nor a database, and those are the only types of objects that can have a doclink. The link requires Notes Unique ID(s) to link to - if it’s a db link, it will contain the Database unique ID. If it’s a view link or a doc link, it will contain the unique ID of the view or document in addition to the DB unique ID. So it needs to be a static, physical object within the database (or the database itself). The only possible parameters for the AppendDocLink method are database, view, or document - that is what the error message is telling you.
What are you attempting to accomplish via this link? What are you connecting to to fetch the data into the LCFieldList?
Perhaps if you share what you are trying to achieve, someone can give you a way that it can be done.
We have a backend agent that uses a Note’s connection to retrieve Requisition documents based on a selection formula and creates DB2 records using LSXLC. After the DB2 record is created, we need to create a Receiving Log document in the same notes database that will link back to the Requisition document.
Couldn’t I just build my own doc link? Something like……
Are the requisition documents in a Notes database? You would need to access it using a NotesDocument object if you want to create a DocLink, not via an LCFieldList.