0
votes

I have a dataview on an xpage that points to a database view on different server. I am able to open the record.Instead of opening the record I want to launch the attachment in that record from the view.

The URL for the record in the view is: http://servername/home.nsf/manual.xsp?databaseName=baseservername!!dc.nsf&documentId=D28E5520C520062885257862006697AE&action=editDocument

I would like to get this URL of the view entry from a function in SSJS and then parse the base server name,database name,document ID and create a URL like this

http://servername/home.nsf/xsp/.ibmmodres/domino/OpenAttachment/baseservername!!Dc.nsf/D28E5520C520062885257862006697AE/body/testing.pdf

Any tips on how to get the URL of the record? Also can the imbmmodres launch the attachment instead of downloading?

2

2 Answers

1
votes

I got it working,and able to download the attachment but not able to launch the attachment. I have used the following code:

function getBaseURL() {
var curURL = context.getUrl();
var curAdr = curURL.getAddress();
var rel = curURL.getSiteRelativeAddress(context);
var step1 = curAdr.substr(0,curAdr.indexOf(rel));

// Now cut off the http
var step2 = step1.substr(step1.indexOf("//")+2);
var result = step2.substr(step2.indexOf("/"));
return result;   
}
baseURL=getBaseURL();// this function from stephen wissell
var d:NotesViewEntry=curRow;
var db=d.getDocument().getParentDatabase()
var fn=db.getFileName();
var baseserver=db.getServer();
var unid:string = curRow.getUniversalID();
var attNames = curRow.getColumnValue("AttachmentNames");

return baseURL + "/xsp/.ibmmodres/domino/OpenAttachment/"    +baseserver+"!!"+fn+"/"+unid+"/LaunchField/"+attNames;

The getURL, getnotesurl, gethttpURL return just the replica id and not the server name, hence they do not server the purpose

0
votes

var address1 = viewvar.getDocument().getURL()

then you can use getHost() or getAddress() from that object to get the parts you need

address1.getHost() + ...