Working with checkbox values and rich text attachments in new document using existing document as source

I hope someone can help me. I’m trying to create a new document based on an existing document. I need to pull in certain fields and populate the new document.I have worked out how to grab plain text and rich text fields, but I can’t work out how to grab the contents of a checkbox containing multiple values, and grab attachments from a rich text field.

Any help would be great. The code I’ve got so far is below :

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace, uidoc As NotesUIDocument, doc As NotesDocument

Set uidoc = workspace.CurrentDocument

Set doc=uidoc.Document

Dim A As String, B As String, C As String, D As String, E As String, F As String, G As String, H As String, I As String, J As String



Dim RTAction As Variant, RTComments As Variant

Dim TextAction As String, TextComments As String

'Get Action Required

Set RTAction = doc.GetFirstItem( "JobDesc" )

If ( RTAction.Type = RICHTEXT ) Then

	TextAction = RTAction.GetFormattedText( False, 0 )

End If

'Get Comments

Set RTComments = doc.GetFirstItem( "Comments" )

If ( RTComments.Type = RICHTEXT ) Then

	TextComments = RTComments.GetFormattedText( False, 0 )

End If

'Get values from Standard Defect Document to place into Stand Alone Defect

A = doc.DefectArea(0)	

B= doc.NavisionGroupDesc(0)

C= doc.NavisionCodeDesc(0)

D= doc.RegComplianceYN(0)

E= doc.Category(0)

F= doc.EquipName(0)

G= doc.Description(0)

H=TextAction

I= TextComments

J= doc.JobDesc

K=doc.NavisionGroup(0)

L=doc.NavisionCode(0)

'Create Stand Alone Defect document

Call workspace.ComposeDocument( "", "", "DefectStandAlone" )

Set uidoc = workspace.Currentdocument



Call uidoc.FieldSetText("DefectArea", A)

Call uidoc.FieldSetText("NavisionGroup",K)	

Call uidoc.FieldSetText("NavisionGroupDesc", B)

Call uidoc.FieldSetText("NavisionCode",L)		

Call uidoc.FieldSetText("NavisionCodeDesc", C)

Call uidoc.FieldSetText("RegComplianceYN", D)

Call uidoc.FieldSetText("Category", E)

Call uidoc.FieldSetText("EquipName", F)

Call uidoc.FieldSetText("Description", G)

Call uidoc.FieldSetText("JobDesc", H)

Call uidoc.FieldSetText("Comments", I)

Call uidoc.FieldSetText("Considerations", J)

End Sub

Subject: Getting values onto new document from multi value checkbox

Darren, the easiest way to put the values from the multi value checkbox onto the new document is to simply create a new backend document for the newly composed uidoc document. For instance, if you Dim newdoc as Notesdocument and set newdoc=uidoc.document then you can simply assign through the original backend document the new field. So the code might look like:

newdoc.newfieldname=doc.checkboxfieldname

This will simply bring over the checkbox field values from the original document.