Help needed with Rich Text Fields

I thought I got it working, but nothing I do is working.

I have a form which displays a different form depending on who you are. Example: Client see’s a request form and Tech sees an Action form. Fields are hidden and will display only depending on who you are.

My issue is the Attachments field, which is a RICHTEXT field.

When a client submits their form for processing, if they attached a file or a snapshot I want that field to be moved into another RICHTEXT field. here is the coding:

Dim doc As NotesDocument

Dim rtitem As Variant

Dim rtitem2 As NotesRichTextItem

Dim item As NotesItem

Dim w As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = w.CurrentDocument

Set doc = uidoc.Document

'…set value of doc…

Set rtitem = doc.GetFirstItem( “Attach” )

Set rtitem2 = New NotesRichTextItem(doc, “Attachments”)

If ( rtitem.Type = RICHTEXT ) Then

Call rtitem2.AddNewline(1)

Call rtitem2.AppendText(“Image/File from Client Form”)

Call rtitem2.AddNewline(1)

Call rtitem2.AppendRTItem(rtitem)

uidoc.Save

uidoc.Close

end if

the form is saving, but nothing is moving…I had a couple of documents move the files, but now nothing is working…Any thoughts?

Thanks

Subject: Weird Thing…Help needed with Rich Text Fields…

Okay I replaced the uidoc.save with Call Doc.Save(False, True) and when I run the script, I get prompted to save…I choose No, and the document closes, yet when I go back in the contents have been moved!

If I way yes to save, they do not appear…What the heck is happening?

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

do the doc.Save, do a uidoc.Close(True) and don’t do a uidoc.Save and see if that helps.

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

Hey Amy,

No go…What I found out is this…

I have to put this entry:

doc.SaveOptions = “0”

call doc.Save(False, True)

uidoc.close

This works, but it puts the form Saving ability to 0…I’m working on having it changed once the document refreshes next time, so I may have a work a round, but if there is a better way, please let me know!

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

Try this

Dim doc As NotesDocument

Dim rtitem As Variant

Dim rtitem2 As NotesRichTextItem

Dim item As NotesItem

Dim w As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = w.CurrentDocument

Set doc = uidoc.Document

'…set value of doc…

Set rtitem = doc.GetFirstItem( “Attach” )

Set rtitem2 = New NotesRichTextItem(doc, “Attachments”)

If ( rtitem.Type = RICHTEXT ) Then

Call rtitem2.AddNewline(1)

Call rtitem2.AppendText(“Image/File from Client Form”)

Call rtitem2.AddNewline(1)

Call rtitem2.AppendRTItem(rtitem)

Call doc.Save(True, False)

Call uidoc.Reload

Call uidoc.Close

end if

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

No go…I get a prompt to save…If I say yes, content doesn’t move. If I say no, content moves to the new field…

Weird…If you say no to the doc.Save, it still saves and it works…thus me having to put the doc.SaveOptions to 0.

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

are you modifying anything in the front end doc in the UI? I think Amy is on the right track, you are making changes to the backend doc then when you save the front end doc it’s over writing the changes you made to the back end, thus it appears the changes are never made. Try this:

Dim doc As NotesDocument

Dim rtitem As Variant

Dim rtitem2 As NotesRichTextItem

Dim item As NotesItem

Dim w As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = w.CurrentDocument

Call uidoc.Save

Set doc = uidoc.Document

Set rtitem = doc.GetFirstItem( “Attach” )

Set rtitem2 = New NotesRichTextItem(doc, “Attachments”)

If ( rtitem.Type = RICHTEXT ) Then

Call rtitem2.AddNewline(1)

Call rtitem2.AppendText(“Image/File from Client Form”)

Call rtitem2.AddNewline(1)

Call rtitem2.AppendRTItem(rtitem)

Call doc.Save(True, False)

Call uidoc.Close

end if

Subject: RE: Weird Thing…Help needed with Rich Text Fields…

Okay …In the form, if it’s not a new doc you get a popup to enter in time…I removed that feature and still got the prompt to save from the doc.Save, but now when I click on Yes, the content moves…

But on a new doc you don’t get the time window…I just tried and it didn’t move over, I even manually saved the document before clicking on the button to transfer the contents…

The work a round I have seems to be working great! I just have the Same Options field to compute and the value to be 1, so when the form refreshes it will automatically change it to be able to be saved…

If you have any other thoughts, let me know…But I do really appreciate both you and Amy’s responses to help!

Subject: Help needed with Rich Text Fields…

Not sure, but I think it might have something to do with the fact that you are manipulating the backend documents (doc), but saving the front end doc (uidoc)

Hope that helps.