Backend Document Issue?

I have an agent that I want to run when documents are pasted into dbC from dbB.What I want to happen is when document 1 is pasted into dbC, it uses a particular form, so I want to run an agent to convert and create a document from that document using the second form.

I have it partially working…

But it won’t grab the field from document 1 and put the contents into a field in document 2. Here is my code:

start agent code

Sub Initialize

Dim session As NotesSession

Dim db As NotesDatabase

Dim docCtx As NotesDocument

Dim docChk As NotesDocument

’ get the database

Set session = New NotesSession

Set db = session.CurrentDatabase

Set docCtx = session.DocumentContext

’ create a new document in the database

Set docChk = db.CreateDocument

’ set the new document’s form

docChk.Form = "PC Support Task"

’ set the new document’s Fields

Call docChk.replaceItemValue( "Problem_Description", docCtx.getItemValue( "tktTxt" ) )



docChk.E1 = ""

docChk.E2 = "" 

docChk.E3 = ""

docChk.E4 = "" 

docChk.E5 = ""

docChk.A1 = ""

docChk.A2 = "" 

docChk.A3 = ""

docChk.A4 = "" 

docChk.A5 = ""

docChk.D1 = ""

docChk.D2 = "" 

docChk.D3 = ""

docChk.D4 = "" 

docChk.D5 = ""

docChk.TimesModified = ""

’ save the new document in the db

Call docChk.Save(True, True)

End Sub

*******end agent code

It completes all other field values (D1, etc), Times Modified, but the 1st one, it doesn’t complete.

Any help would be appreciated. It appears I am using something incorrectly to accomplish this. It is all automated in the backend, and that is probably an issue.

THANKS!

Subject: Backend Document Issue?

Chris,

replace your “Call docChk.replaceitemValue…” with

dim new_item as notesitem

set new_item=docCtx.getfirstitem(“tktTxt”)

set new_item=new_item.copyitemtodocument(docChk, “Problem_Description”)

HTH

Mike

Subject: RE: Backend Document Issue?

Thanks man, what a saver.Now i’m getting object variable not set, but i’ll deal with that. Let me check out some stuff.