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

Hello,

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)
	Source.EditMode=True
	Call Source.FieldSetText("field1","1")
	Source.Save
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!
janineoAsked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
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".
0
 
CRAKConnect With a Mentor Commented:
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.
0
 
doninjaCommented:
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 ?
0
 
larsberntropCommented:
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.
0
 
janineoAuthor Commented:
Thankyou for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.