Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Use RunOnServer to process secure reports in the background

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#RunOnServer or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/RunOnServer


I had a requirement to allow HR and staff to request reports on Absence or sickness reports. They wanted to be able to request reports on a person they managed, or a project they were a manager of or general statistics.





How do you give users access to statistics based on confidential data without giving them access to the documents themselves?

 

I soleved the problem using Lotus Notes method for the domino agent class RunOnServer.

An HR manager wanted to know how many days were taken off due to illness in a certain month, but was not allowed to see the actual personal data ie who took the days off and the reasons why.

Now as the developer I could just run the report and print off the data for the user when they required, but I want to develop not be a report writer!

 

Here is the technique: You have an agent that does the searching and collating of data which has the top access rights and so has access to the documents.

The user who has an [HR] role is able to submit request documents for different statistics:

Days off per month by reasons: cold, back ache, sports injuries etc

The agent is then run on the server and the results are emailed to the HR user.

This worked fine, in fact it had advantages as we now had a log of who was requesting these reports.

The only problem was that the user's machine was held up while the runonserver request was running. if this was a big request such as year stats then this could take a few minutes which of course is not desirable.

The solution was to invoke an intermediate agent that actually ran the agent.

 

So the code in the submit button on the request was:

@postedCommand([FileSave]);

@postedCommand([FileCloseWindow]);

@postedCommand([ToolsRunMacro]; "(StartRequestAgentOnServer)" );

 

This Start Request Agent then had the code:

Dim s as new notessession

dim db a snotesdatabase

set db = s.currentdatabase

dim a as notesagent

set a = db.getagent("(ProcessReportRequests)")

if a is nothing then

  Messagebox "Cannot load ProcessReportRequests Agent. Contact notes team."

end

end if

call a.runonserver()

Print "Report request submitted. The report should arrive in your email box in a few minutes."

 

The ProcessReportsRequests agent then was signed with the full Admin rights id and had access to all of the data.

The Notes Agent finds all Requests with status="Awaiting Processing", changes the status="In Progress", runs the report and changes the status to "Processed" or "Error" and sends an email to the developer if there is an error or to the user if it runs ok.

NB: You cannot runonserver an agent that is scheduled. See http://www.NotesNinjas.com/#RunOnServerBug

FYI:  Another discussion on using RunOnServer: Andrew Pollack's Vision for Hire  that uses notessession method SendConsoleCommand to interact with the server.

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Lotus Notes and Domino 6 Programming Bible by Brian Benz, Rocky Oliver
Covers all the programming techniques, concepts, and languages used with Notes and Domino, as well as the many new features of Domino 6 Thoroughly examines the Notes and Domino role with Java, XML, Web services, and other IBM products and technologies Provides extensive code and examples, many geared to the needs of administrators High-profile authors, known to their audience through conferences and articles Companion Web site shows example applications from the book running on a live Domino server and provides code download.
See at: Amazon.co.uk | Amazon.com |