• Calling Notes agent from within the login control

    By Patrick W Kennedy 1 decade ago

    I love this login control and have adapted it to several other purposes, however, my current login process utilizes a rather lengthy and complex lotusscript which is called by an agent.  I have, so far, been unsuccessful in my attempts to call the agent from within the dojo login control.  The ability to call outside agents on submit would greatly enhance the utility of this feature.

    When using the code below, I receive an error stating the 'database' is not defined.  This is standard javascript code.  Does Dojo require a different code?

    var agentName = "agentName";
    //get the input parameter
    var username = dojo.byId('#{id:username}').value;
    var password = dojo.byId('#{id:password}').value;

    //create In Memory Document
    var doc = database.createDocument();
    doc.appendItemValue("UserName",username);
    doc.appentItemValue("Password",password);

    var agent = database.getAgent(agentName);
    if (agent != null) {
        agent.runWithDocumentContext(doc);
    }

    • this can not work,but there is a solution ;-)

      By F. Kranenburg 1 decade ago

      You are mixing two languages together. Dojo is a client side javascript language (like in javascript that is running in the browser). You can't call serverside javascript from it.

      Do you have the Xpages Extension Library installed? If yes then you should use the jsonRPCservice component. This component will allow you to send the username and password with dojo to the server and call serverside javascript there (SSJS). In there you can call any kind of server code you would like, including the info from the parameters.

      If you need help with this, send me a message (fkranenburg@yahoo.com) with your database, I'll help you out.