logo

New Response

« Return to the main article

You are replying to:

  1. Here is another example

    I created a test form called Name;

    Here is the agent that creates a new document;

    import lotus.domino.*; import javax.swing.*; import java.awt.*;

    public class JavaAgent extends AgentBase {

    public void NotesMain() { String fname; String lname; try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); fname = JOptionPane.showInputDialog("Enter your first Name"); lname = JOptionPane.showInputDialog("Enter your last Name"); String fullName = fname + " "+ lname; String welcomeMsg = "Your document will now be saved " + fullName; JOptionPane.showMessageDialog(null, welcomeMsg); doc.replaceItemValue("Fname", fname); doc.replaceItemValue("Lname", lname); doc.replaceItemValue("Form", "Names"); doc.save(); JOptionPane.showMessageDialog(null, "Your document was saved"); // (Your code goes here)

    } catch(Exception e) { e.printStackTrace(); } } }

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: