There is a similar question to this already at: https://communities.ca.com/thread/241689547#comments But there is no answer provided other than I should be asking it here. I need to produce a list of links within a PAM IRF & generated email to SDM Request Attachments. I'm already looping through the attachments and getting all of the pertenant information regarding them (ids, file names etc).
I attempted to do something similar to what is being discussed here:
Downloading attachment using CA Upload servlet using following link
But am having no success. I get a bpsid using the getBopsidResponse SDM Invoke call and place it in there along with a session ID and end up with a link that looks like this:
https://myhost:8443/CAisd/UploadServlet?AttmntId=420764&Bpsid=1069794953&retURL=http://myhost/CAisd/pdmweb.exe?SID=1942889762+FID=1234567890
This appears to be the same servlet that is used out of the box with SDM and seems to be similar in how the popup window works when you click on one of the attachments within the details page on a request having attachments only that in my case I end up downloading the UploadServlet file or am staring at a blank white screen.
My prototype work flow looks like this:
And so I wrote a processing script that looks like this:
Process.BaseXML = convertXml(applyXPath(Process['SEL_Attmnts'].SoapResponseBody,"//doSelectReturn")).text_;
var xpGetAttribute = function (attrId,xml) {
var xpath = "//AttrName[text()='" + attrId + "']/following-sibling::AttrValue/text()";
return applyXPath(xml, xpath);
}
Process.attachments = applyXPath(Process.BaseXML,"//UDSObject",true,true);
//loop the attachments
Process.links = '<ul>';
var bopsid = Process.Invoke_Service_Desk_Web_Servic_1.getBopsidReturn;
var sid = Process.Invoke_Service_Desk_Web_Servic_1.ServiceDeskSessionID;
var host = 'MyHost';
for(i=0;i<Process.attachments.length;i++){
var attXML = Process.attachments[i];
var name = xpGetAttribute('attmnt.orig_file_name',attXML);
var attid = xpGetAttribute('attmnt',attXML);
var fid = Math.random();
var szlink = "http://"+host+"/CAisd/UploadServlet?AttmntId=" + attid + "&Bpsid=" + bopsid + "&retURL=http://"+host +"/CAisd/pdmweb.exe?SID=" + sid + "+FID=" + fid
Process.links += '<li><a href="'+szlink+'">'+i+': '+name+'</a></li>';
}
Process.links += '</ul>'
Any help here would be greatly appreciated!
Best Regards
Joel-