Getting the url in server-run agent

I have a LS Agent that runs on the server. Currently it sends an e-mail containing a doclink to several documents within the database.

The user wants to change this to a url link instead and I’m having problems getting the server name. I am trying to format the url with the following line of code:

url=“http://” & dbserver(0) & “/” & dbname(0) & “/” & docid(0) & “?OpenDocument”

The result I get in the e-mail does not include the server name:

http:///webpres/PRODUCTT.NSF/CEF6EC8B372AD6E386257228004D9CF5?OpenDocument

Can someone point me in the right direction?

Thanks,

mary

Subject: Getting the url in server-run agent …

How / where are you setting dbserver(0)?

Subject: RE: Getting the url in server-run agent …

Here’s the code:

dbname = Evaluate({@WebDbname})

dbserver = doc.Server_Name

docid = Evaluate({@Text(@DocumentUniqueID)},doc)

I have also tried using:

This gives me the Notes Server name ==>

dbserver = Evaluate({@Subset(@Dbname;1)},doc)

This one gives me a blank ==>

dbserver = Evaluate({@GetHTTPHeader(“Server_Name”)}, doc)

Subject: RE: Getting the url in server-run agent …

Did you try something like:

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

dbserver = db.Server

Is Doc.Server_Name defined as a field on the form and have a value in it? It should probably be Doc.ServerName(0)

Subject: RE: Getting the url in server-run agent …

Tom, I tried your suggestiona nd that still gives me the Notes Name for the server and not the “www.xxx.com” like I need.

Subject: RE: Getting the url in server-run agent …

Put an editable hidden field on your form and name it HTTP_Host (this is a reserved CGI variable) and reference it via

Doc.Http_Host(0) - dont forget the (0)

Subject: RE: Getting the url in server-run agent …

No difference in the results. I’m still getting a blank.

Thanks for your help – I appreciate it.

Subject: RE: Getting the url in server-run agent …

Did you put a default value of Http_Host for the field? It could be your browser is caching this info as well.

Is there anything in the field named http_Host? It should default to the server name.

Subject: RE: Getting the url in server-run agent …

no default value in HTTP_Host.

Won’t that just pick it up if the document happens to be open in the browser? This is the server agent looking at the document.

Subject: RE: Getting the url in server-run agent …

To get the server name without the hierarchal components of the name use

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim servername as new NotesName(db.Server)

url=“http://” & servername.Common & “/” & dbname(0) & “/” & docid(0) & “?OpenDocument”

Subject: Getting the url in server-run agent …

Hello Mary,

According to a message posted in the CodeBin on OpenNTF ( http://www.openntf.org/Projects/codebin/codebin.nsf/CodeSearch/B9DF92D8E753349688256BDC000CC1B5 ) there is a hidden NotesSession property called “InternetHostName”.

Try that instead of dbserver(0).

Good luck,

Marleen