ccjx
ccjx

Reputation: 95

How to send lotusscript in an email programmatically?

I am trying to programmatically generate lotusscript (in a form of a scriptable button) from a web application (Java EE) and send it to an end-user who will then run it in his/her Lotus Notes client.

How can I achieve this? Is there an API for me to use in order to embed lotusscript in an email?

Upvotes: 3

Views: 2208

Answers (3)

David Navarre
David Navarre

Reputation: 1022

Another option is to embed a URL to open a Page design element with your code (or a call to the agent) in the QueryOpen, so it runs when the page opens.

Notes://myserver.mycompany.com/utilities.nsf/MyTaskLauncher?OpenPage

I'm not sure if it could pass parameter values or if you have to rely on the user's credentials to determine the proper information.

Advantages:

  1. Code resides in one location, so I can update it if I find out there was a bug in the original version.
  2. Minimal manipulation of the user's mail file with stored forms.
  3. Smaller email message, since I don't have to send along form information.
  4. Easier to build a simple string in Java EE than the higher-powered solutions.
  5. The agent can either use the signing ID or run with the user's credentials.
  6. Can be sent to any email address, so long as the recipient has a Notes client.

Upvotes: 1

Panu Haaramo
Panu Haaramo

Reputation: 2932

Here is an idea. I haven't tried it and am not certain that it will work:

  1. Create form with a LotusScript button in Domino Designer and set to be stored in the document
  2. Create a document with that form
  3. Export the document as DXL (Domino XML)
  4. In your Java EE application use ncso.jar to import the DXL (you can modify the LotusScript in the XML first as needed)
  5. Email the document using Document.send(). When connected to Domino server with CORBA/IIOP, I think this should work.

Update

You might be able to skip the DXL part and just modify the LotusScript in the document item. I understood that you have to modify the LotusScript for each recipient. If not then everything is much easier (see Richards answer).

Upvotes: 3

Richard Schwartz
Richard Schwartz

Reputation: 14628

Rather than trying to embed a button, I would consider taking advantage of the 'stored form in document' feature of Notes.

I.e., using Domino Designer I would manually create a database (I'll call it "MyDb.nsf" for convenience). Create a form in this database ("MyForm" for convenience) and set it up with the required fields for an email message (SendTo, Subject, Body, etc.). Then create a button on the form and enter the LotusScript code.

With this done in advance, your code can take advantage of the optional attachForm parameter in the Document.send() method.

What you would do is open MyDb.nsf in the usual way, then use Database.createDocument() to create your document in that database, then use Document.ReplaceItemValue("Form","MyForm") to bind this document to your form. Also set the other Items (e.g., Subject, SendTo, Body) as needed, and when you're all done call Document.send(true). This will embed your form in the document and send it, so the LotusScript code will travel in the embedded form that is sent with the message.

I think this might be the best method for you, because I think that this will preserve the signature on the form when it embeds it. I'm not sure about that, but on the other hand I'm much more certain that any other way of sending with CORBA/IIOP will give you an unsigned script (because CORBA/IIOP has no access to the private key needed to sign the document). And an unsigned script will mean that your users get ECL warnings when they execute it -- and that could result in them adding an entry to their ECL to permit unsigned scripts, and that's a bad security practice.

Upvotes: 3

Related Questions