Fieldappendtext not appending text

I’m stumped.

I have a set of actions in a form. Each action calls a sub in a script library. That sub calls another sub in the same script library which contains the following code:

Sub updateHistory (status As String, docUI As NotesUIDocument)

Dim session As New NotesSession



Dim lineItem As String



lineItem = Chr( 13) + Chr( 10 )  + " [" + Date$ + " " + Time$ + "]" + "Status changed to " + _

status + " by " + session.commonusername 



Call docUI.FieldAppendText("History", lineItem)

End Sub

The problem comes when the sub calls the fieldappendtext method. I know that lineItem contains a value (checked during debug), but the value is not appended. What am I missing? Thanks to anyone who can point me in the right direction.

Chad

Subject: fieldappendtext not appending text

is the History field Editable and is the document in edit mode?

Subject: RE: fieldappendtext not appending text

Yes and Yes

I should say that during debug the docUI property “EDITMODE” was set to “True”.

Subject: RE: fieldappendtext not appending text

is there already a value in the History field to append to? I’ve had issues where the method wouldn’t work if the field was blank to begin with, but it usually throws an error if i remeber correctly. Is this a new doc or an existing doc? Maybe try forcing a save before calling the updatehistory sub.

Subject: figured it out

I added the code:

Call docUI.Save

directly after the call to fieldappendtext. Now it’s working. Go figure. I was calling Save at the end of the parent Sub, but not before exiting out of the updateHistory Sub. i guess notes wanted to save its work before moving on to the next thing. Thanks for your help.