Domino objects

You can access through JavaScript the Domino Objects available through Java and CORBA. See Java/CORBA classes in Domino Designer Programming Guide, Volume 3.

Take the following steps:

  1. On the form or page that will include the JavaScript code, create an applet that extends AppletBase. See Running a Java program and the associated examples in Domino Designer Programming Guide, Volume 3 for coding such an applet. See Including Java Applets in Applications in Application Development with Domino Designer for instructions on including applets on forms and pages. The applet can do anything. It is there just as a gateway to the Domino Objects.
  2. In the Java Applets Properties box, select Applet uses Notes CORBA classes.
  3. For Notes client deployment, select Enable Java access from JavaScript in the User Preferences box. Also click the Security Options button, then select the Java applet security radio button, and make sure Access to Notes Java classes is selected for the appropriate users.
  4. For access to the classes through CORBA, make sure the Server record in the Domino Directory correctly records who can Run restricted Java/JavaScript and Run unrestricted Java/JavaScript in the IIOP Restrictions section under the Security tab.
  5. In the JavaScript code, refer to the applet to access the classes and methods for the Domino objects. You first want to call AppletBase.openSession( ) or AppletBase.openSession (username, password) to obtain a Session object. For example, if the applet extending AppletBase is the first applet on the form or page, and a user name and password are not needed, the following code works:
    session = document.applets[0].openSession()

You can then use the returned Session object to get at the other Domino objects. If you instantiate other Domino objects in the Java applet, you can use them directly in the JavaScript code.

In the Notes client, you can call AppletBase.getContext(Session) to get a NotesAppletContext object. This object contains the following methods: getServer( ) returns the name of the server containing the applet or a blank string for a workstation; getDatabase( ) returns the file path and name of the database containing the applet; getDocument( ) returns the universal ID of the document containing the applet or null if the document has not been saved.