How do I display a Lotus Script variable within a browser?

Posted on 2011-04-20
Medium Priority
Last Modified: 2013-12-18

I am working in Lotus notes and have the following problem.

I have a Lotus Notes form. On initialize I have my own custom dll that I pass a parameter into which returns a URL. I call it using the following lotuscript (which all seems to work):

Dim myObj
Dim strInput As String
Dim strReturn As String

strInput = "test input string"
Set myObj=CreateObject("MyDLLName.clMain")
strReturn = myObj.EncryptMe(strInput, True)	

Open in new window

I now need to display this URL to the user. I have created a field on the form called Field1. In the onload event for the form I have added the following code:

Sub Onload(Source As Notesuidocument)
	Call Source.FieldSetText("field1","1")
End Sub

Open in new window

Here is the problem - opening this form in Notes shows my URL being displayed correctly. However, opening the form via a web browser does not display my URL. I have read a few articles saying that Notesuidocument is not supported on browsers, but how can I get around this and display the value of the returned variable online?

Thanks for reading!
Question by:janineo
LVL 46

Accepted Solution

Sjef Bosman earned 1200 total points
ID: 35433889
Some things you need to know:
- there is NO LotusScript when opeing a form from a web browser
- except for two agent events: WebQueryOpen and WebQuerySave

In your case, you have to put all code in an agent, and set it to be called from the agent list, running on no documents. There are a few ways to show script output in a field on the screen. One is to assign a value to an item, in the WebQueryOpen agent, using
      Call doc.ReplaceItemValue("item", value)
beware: don't save the document!

Then, on the form, use a Computed field, named "item", value "item".
LVL 13

Assisted Solution

CRAK earned 800 total points
ID: 35436369
NotesUIDocument (or any other UI object) can indeed not be used in any agent running on the server (e.g. for web, scheduled)

Assuming you're using a WebQueryOpen agent (i.e. an agent triggered when a webpage is requested), you could try to PRINT to the webpage. Print "tekst" would appear somewhere in the HTML, Print "[url]" would launch url. That might give you an alternative. Messagebox would send your message to log.nsf on the server.
As a 3rd alternative, have you considered using a log database? Checkout the NotesLog class.
LVL 10

Expert Comment

ID: 35439350
As another posibility to get a lotus agent to run on a document.
Have the form redirect to another URL if a field is not set that could be the encrypted data.
Redirect to agent using xx.nsf/agentx?openagent&docid=yyyyyyyyyy  etc
The agent can then run lotus script to get value, run the ddl and save back to linked document, and finally use print command to create a html document that reopens the original document.
Original doc now has value in field so opens normally ?
LVL 11

Expert Comment

ID: 35439375
To avoid Save prompts, put it on the form as a Computed for Display field
Note the wording for the agent: WebQueryOpen

That means the agent is run BEFORE the document is passed to the web rendering engine.

For more info: Open up designer help (I have link to the nsf readuily available since i am used to that interface as opposed to eclipse style help)
click on index, type "webq"

expand subject by typing * (Asterisk)  read articles.

Author Comment

ID: 35688806
Thankyou for the help.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question