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

Posted on 2011-04-20
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

    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

    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

    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 10

    Expert Comment

    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

    Thankyou for the help.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
    Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now