Uidocument does not appear

Hi all,

I need to open open 2 docs in the ui via LS, one after another, but the 2nd will not open visibly.

the script goes like:

============================================

… got templatedoc somehow …

then:

'create my first uidoc (from that already stored templatedoc)

Set uidoc = ws.EditDocument(True,templatedoc)

Call uidoc.GotoField( “TPL_Body” )

Call uidoc.SelectAll

Call uidoc.Copy

Call uidoc.Close(True)

'The following is just to be sure that closing the 1st is finished before I open the 2nd (without this the effect is the same …)

While Not uidoc Is Nothing

Sleep 1

Wend

sleep 1

'–– now create a new Memo –

Set doc = db.CreateDocument

doc.Form = “Memo”

Set source = ws.EditDocument(True,doc)

Set doc = source.Document

If source.CurrentField <> “Body” Then

Call source.GotoField(“Body”)

End If

Print source.CurrentField '-- Prints “Body”

'… do sth. … in my case:

Call source.Paste

'but even with no code there the new doc will not appear in the UI.

===========================================

thanks for any help

Uwe

PS:

if I run the agent in debug mode, it works (most of the time, not always …)

And if I place the line:

Call uidoc.Close(True)

to the end, after opening the 2nd uidocument, it works … but I am not happy with that - not sure if it doesn’t just work by accident.

Subject: uidocument does not appear

HiMay I suggest another path? Why dont you try and copy the field from one document to the other in the background? And at the end just open the second document to the user/UI? Usually users get a bit confused if “things” happen in the UI without their intervention.

Regards,

Subject: it’s a rich text field

Hi Barbara,

thx for your reply.

I first tried that way (because I do not want to use such UI copy/paste methods), but it is the formatted content (including grafics) of a rich text field, which should be placed in the beginning of a new email, in front of the user’s signature.

When I do this with backends methods, I do not get the wanted result. An item copy for richtext just do not work (at new memos and with inline grafics)

The best was doc.RenderToRTItem(rtitem) but it placed it after the user’s signature.

Or do you know another way?

Uwe

Subject: rich text field not visible until you save/close

You will see this warning in Help. You must save the document, then re-open it.

Subject: exactly - and therefore I use the copy/paste method in the uidoc

because I do not want to save a newly created mail at once.

But do you know why my 2 uidocs behave that … weird?

Uwe