Hello everyone,
I’m building a customer portal using Angular, and my next step is allowing customers to view SSRS reports in a PDF viewer like you normally would. On the detail page for sales orders (in our site, not in Epicor), there will be a button to print the selected order. This action triggers the following REST call:
https://e102/ERP102200/api/v1/Erp.Rpt.SalesOrderAckSvc/SubmitToAgent
I include the required JSON in the body of the POST request for the particular sales order. When this request is sent directly to Epicor, the SSRS report pops up in a PDF viewer. However, like all other REST calls we use, the request should be sent to the NodeJS server first and then called from there - but this doesn’t work. The report is being generated, as seen in the System Monitor, but the PDF doesn’t show up.
How can I let our Node server know to direct the SSRS report to the browser, if that’s even a thing?
This is the Node call to Epicor:
router.post('/portal/print', function(req, res){
let idNum = req.query.idNum;
let queryStr = "https://e102/ERP102200/api/v1/Erp.Rpt.SalesOrderAckSvc/SubmitToAgent";
options = {
url: queryStr,
json: {
"ds": {
"SalesOrderAckParam": [
{
"OrderNum": idNum,
"SysRowID": "00000000-0000-0000-0000-000000000000",
"AutoAction": "SSRSPREVIEW",
"AgentSchedNum": "0",
"AgentID": "SystemTaskAgent",
"AgentTaskNum": 0,
"RecurringTask": false,
"ReportStyleNum": 1005,
"WorkstationID": computerName,
"ArchiveCode": 0,
"NumericFormat": ",.",
"ProcessTaskNum": 0,
"DecimalsGeneral": 0,
"DecimalsCost": 0,
"DecimalsPrice": 0,
"GlbDecimalsGeneral": 0,
"GlbDecimalsCost": 0,
"GlbDecimalsPrice": 0,
"SSRSRenderFormat": "PDF",
"PrintReportParameters": true,
"SSRSEnableRouting": true,
"RowMod": "A"
}
],
},
"agentID": "SystemTaskAgent",
"agentSchedNum": 0,
"agentTaskNum": 0,
"maintProgram": "string",
},
rejectUnauthorized: false,
auth: {
user: config.epicorCredentials.user,
pass: config.epicorCredentials.pass
}
};
// request is a library to simplify making http requests in Node
request.post(options, (error, response) => {
if (error) {
console.log("Error! Details: ", error);
res.send(error);
}
else if (response.statusCode === 200){
res.send({});
}
})
})