GetFirstItem and Rich Text Fields

Hello everyone,

I’m attempting to create an attachement in a rich text field. However, when I use:

dim ws as New NotesUIWorkSpace

dim uidoc as NotesUIDocument

dim doc as NotesDocument

dim rtitem as variant

set uidoc=ws.CurrentDocument

set doc = uidoc.Document

set rtitem=doc.GetFirstItem(“fieldname”)

and “fieldname” is a rich text field then rtitem comes up empty or as nothing. I used the dim statement as per the help for doc.GetFirstItem with no change in the behavior. I’m using the 6.0 client on a 6.0.1 server. Any ideas on what’s happening here? Any help would be greatly appreciated.

Thanks in advance,

Keith Strickland

http://www.keithstric.com

Subject: GetFirstItem and Rich Text Fields

Read about NotesUIDocument.Refresh method to understand why GetFirstItem isn’t giving you the rich text item.

You will not be able to use LotusScript to create an attachment in a document that’s being edited. This has been discussed extensively in the Notes 5 forum.

You can, however, create the attachment using macro language. Some have been known to write two agents – one in LotusScript to prepare or locate the attachment file, a second in macro language to attach it. These two agents can then be run from a single form action.

Subject: RE: GetFirstItem and Rich Text Fields

Thank you Andre

Keith Strickland

http://www.keithstric.com

Subject: RE: GetFirstItem and Rich Text Fields

You will not be able to use LotusScript to create an attachment in a document that’s being edited. This has been discussed extensively in the Notes 5 forum.

Eh? But you can… it’s just a bit of a hack. OK, so Keith will have to create the rich text item rather than simply use GetFirstItem, but it can be done.

Or am I missing something? And yeah, it’s a hell of a lot easier with formula!

Subject: RE: GetFirstItem and Rich Text Fields

What, you mean create the attachment and have it not show up on the screen until the document is saved, closed and reopened? I don’t consider that acceptable from a UI standpoint, and in addition, it’s actually more difficult to implement than the solution I described.

Or are you referring to the arcane method that involves saving the document with the SaveOptions set to “0” and so on? That’s more complex also, and in addition is precisely the sort of thing that can stop working suddenly with a new version. It’s cool, I grant you, but if you can find any other way…

Subject: RE: GetFirstItem and Rich Text Fields

What, you mean create the attachment and have it not show up on the screen until the document is saved, closed and reopened? I don’t consider that acceptable from a UI standpoint, and in addition, it’s actually more difficult to implement than the solution I described.

Yup, that’s the one. I don’t get any flicker or anything, so although it’s really clunky, if the user has to have it I don’t see what’s unacceptable about it.

But like I said, you won’t get any argument from me with regards the complexity of such a “solution” – it is indeed nasty! Much better to use formula.

Subject: RE: GetFirstItem and Rich Text Fields

When I said unacceptable from a UI standpoint, I didn’t mean because the screen would flicker. I meant because the document is saved when the user hasn’t specifically requested to save the document. If they never do click the “save” button, they might be unpleasantly surprised later to find that those changes got saved anyway.

Subject: Gotcha. Yeah, that means even more code. Yuck. (WAS: GetFirstItem and Rich Text Fields)