WEB: Fill doc fields from an agent

Hi all. When I open a document or I compose a new one, I wish to (in WebQueryOpen event) run an LotusScript agent that perform an action and get some information in my document (new or not).

Somebody can help me? Thanks a lot.

Subject: WEB: Fill doc fields from an agent.

No entiendo bien tu pregunta.eso lo puedes hacer solo debes de poner el nombre del agente en el webqueryopen y trabajar con las clasa de LS.

Subject: RE: WEB: Fill doc fields from an agent.

Ok, but with my agent in LotusScript I can´t get the UI document, in order to assign values… can you understand me?


In Spanish: Ok, pero con mi agente en LotusScript no puedo obtener el documento UI para asignarle valores. Se entiende?

Thanks a lot. Muchas Gracias.

Subject: RE: WEB: Fill doc fields from an agent.

The “UI document” in a WebQueryOpen agent is NotesSession.DocumentContext, a NotesDocument. You can set field values normally, using doc.FieldName=value or Call doc.ReplaceItemValue(“Fieldname”,value)

Subject: RE: WEB: Fill doc fields from an agent.

Thanks a lot Stan. But only one question remain… in my agent, i call a function that is in a Script Library. The return value is not assigned to the field:

Dim ret As String

ret = traerValorSG()

Dim doc As notesdocument

Dim session As New notessession

Set doc = session.DocumentContext

doc.aaa = ret

but when I asign a simple string value, this works ok.

Thanks in advance!

Subject: RE: WEB: Fill doc fields from an agent.

A tip: in the server console I see the error: “Cannot create automation object” when the agent get the LSLibrary value.Hope this help you, so you can help me. :slight_smile:

Thanks.

Subject: RE: WEB: Fill doc fields from an agent.

You need to Use “YourScriptLibrary” in the Options section of the agent code.

Subject: RE: WEB: Fill doc fields from an agent.

I’m using it. :frowning:

Subject: RE: WEB: Fill doc fields from an agent.

Well, you won’t get much more help unless you post much more code – all we can do is guess right now (and it seems I guessed wrong because you didn’t even include the Options and Declarations of the agent, let alone the cript library).

Subject: RE: WEB: Fill doc fields from an agent.

Thanks stan, now i will to work on this, and in few hours i will publish this question again, with much more information, in order you (or somebody) can help me.

Again, THANKS.