Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I call a server side function and show results in a form?

Posted on 2011-05-09
9
Medium Priority
?
405 Views
Last Modified: 2013-12-18
Hello,

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

I have my own custom dll that I pass a parameter into which returns a URL. This dll needs to live on our server and cannot be ditributed. 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

      


The problem I have is that I have a Lotus Notes form. Prior to showing the form to a user, I'd like to call a server side function (passing in a couple of variables from the document) that will return a string. I then need to embed this string into the document.

How should I go about doing this? I have thought about placing the lotus script above within an agent, and calling it via a form event but am unsure as to how to do this (or embed the resulting string).

Thankyou,
0
Comment
Question by:janineo
  • 5
  • 3
9 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 35720563
Simple question, but the answer depends on the Notes/Domino configuration you have.

R8.5+ : use a server XPage
otherwise: create a button that calls an agent using RunOnServer that produces a document; then open the document; use a temp.setting in the document to indicate that it should be removed during the night when the document isn't saved by a user

Needless to say that this won't work on a local replica...
0
 

Author Comment

by:janineo
ID: 35720715
Hi sjef,

Thankyou for the comments...

Is it be feasible to add a new field to my original form and set it's value based on feedback from the agent? It seems a bit of a hack to create a new document and delete the old one.

i.e form loads - agents is called - field on form is populated with this value.

Also how do I go about calling an agent (passing in some parameters). I am new to notes so if you have a sample it will really help.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 35721247
> i.e form loads - agents is called - field on form is populated with this value.

Well, that isn't going to work. The form (NotesUIDocument) is local, whereas the agent runs on the server, so all data has to be communicated some way. The easiest way is through the document itself. So in fact, it's the other way around:
- call the agent (e.g. by means of a button)
- the agent creates the document with the url, on the server
- then open the document in a form

By the way: is the generation of the URL so special that you need to do it on the server, even by using a DLL?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:janineo
ID: 35726989
hello again

Yes I am afraid that our dll must reside on the server.

I have done something similar with webforms and utilised webqueryopen to call the server side agent which then updated a field on the page before it was served up to the client. I was hoping it would be feasible to do something similar with a standard form - ie. utilise the forms initialise method.


0
 
LVL 10

Expert Comment

by:doninja
ID: 35727520
If the opened document has been saved on the server prior to calling the agent then you could pass the doc's universalID and get the agent to add the result directly and the browser just reloads the saved document.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 35727616
> ... to do something similar with a standard form ...
Nope, not possible. In web much more is possible, also because everything runs on the server.

Apart from the agent-method I mentioned above, it could also be done using the NotesDocument.getDocumentByURL method. With it, you might call an agent that creates and initialises a document through the HTTP-server of your Domino server. You can then update the document with the fields/items you need, and then open it to the user.

In any case, you have to create the document before you show it to the user. AFAIK, there is no way to call a server-side agent that returns its output to the client.

Best is to
- create a document
- call a server-side agent that initialises the document
- show the document to the user

Something like (I left out the declarations):
Set doc= New NotesDocument(db)
Call doc.Save(True, False)
Set agent= db.GetAgent("dllAgent")
Call ag.RunOnServer(doc.NoteId)
Call ws.EditDocument(doc)

Open in new window

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 35727627
And you might need to add a Call doc.Reload after line 4 indeed...
0
 

Author Comment

by:janineo
ID: 35754815
thanykou sjef - it works!! :)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 35755117
Ah, okay, good! Don't forget to have some cleanup-agent that removes unused temp documents, when someone doesn't save the document. And make sure that correctly saved documents aren't removed by the same agent...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

569 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