Getting field value via web and storing in doc field

Greetings.I need some help with this one…

When creating a document via web-browser, I need a field to be automatically populated with the contents of the “Total” field from the first document in “ON” view.

The “ON” view is sorted and the first document in this view is the one to be used as “target”.

Whenever composing a new document, a field “InitTotal” in this document must contain the value from the target document´s “Total” field.

Using @DbLookup and other formula commands, it works fine, but that only happens within Notes. When doing this via web, the @DbLookup does not work.

In short, I need a LS script to “go” to the “ON” view, get the first document and from this one, get the “Total” contents, populating the “InitialTotal” field in the new doc.

As a newbie in LS, any help would be greatly appreciated.

Thanks in advance,

Rubens

Subject: Getting field value via web and storing in doc field

Put this in an agent, and then call the agent from the WebQueryOpen of the form.

Dim s as new notessession

dim doc as notesdocument 'this is the web doc being opened

dim lookupView as notesview

dim lookupDoc as notesdocument

set doc=s.documentcontext

set lookupView=s.currentdatabase.getview(“ON”)

set lookupDoc=lookupView.getfirstdocument

Call doc.ReplaceItemValue(“InitTotal”, lookupDoc.getItemValue(“Total”)(0))

Haven’t tested it so there might be a typo, but this should get you started.

Subject: RE: Getting field value via web and storing in doc field

Hi Michelle.Thanks for your answer.

By using this code, whenever the end-user (via Internet) tries to compose a new document (in which this auto-numbering code should work) the system cannot open the new doc…

What am I forgetting?..