Linking to a Lotus Notes Page with ColdFusion
I don’t know much about the world of Domino, but I’ve done my share of integration with Lotus Notes in the last couple of years. Usually, it’s by 3rd party apps and poor hacks. They really don’t make it easy sometimes. Recently, I wanted to link an Intranet application to a Lotus Notes Yellow Pages type database. The goal was to be able to select a person from my application, hit a link, and popup a copy of that persons entry in the yellow pages. The database was already setup by the Domino folks to be web accessable, however I wanted to go right to a specific record.
The first thing I learned was that the first sorted column in any given Lotus Notes view is the Key. So, the first thing I did was to find a view that had the data I needed, with the key being the ID of the users in the database (which I had in my Intranet application).
Next, I found that, as long as the database is Internet ready (not sure of the Domino term), you can access it like so:
http://servername/databasepath/databasefile.nsf/viewname/keyvalue?opendocument
The parameter “opendocument” should be static – that is the command to get the document. Everything else in that statement should be replaced to reflect your evironment and database. After getting this to work outside of my application, I used CFHTTP to get the document I needed from the server, and pass it back to the user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <cfset variables.domPath = 'http://servername/databasepath/databasefile.nsf/viewname/' & form.id & '?opendocument'> <cfhttp url="#variables.domPath#" redirect="yes" resolveurl="yes" result="domPage" /> <cfif isDefined('domPage.ErrorDetail') and domPage.ErrorDetail neq ''> <script language="javascript"> alert('Unable to connect to the Domino Server.'); window.close(); </script> <cfabort> </cfif> <cfif domPage.responseHeader.status_code neq 200> <script language="javascript"> alert('Unable to find any such Record.'); window.close(); </script> <cfabort> </cfif> <cfoutput>#domPage.fileContent#</cfoutput> |
I just pass an ID to the page (which is the unique identifier), and I get the data and pass it back to the user. You could also, of course, just forward the user right to the page. I opted to go the route of having the ColdFusion application get the data to reduce the likelyhood of errors if the user didn’t have access to the Domino server.
Hope this helps someone!
