This topic contains 3 replies, has 0 voices, and was last updated by chanarbon 7 years, 10 months ago.
-
AuthorPosts
-
December 27, 2016 at 12:05 am #5651
sravanmHi,
I am trying to get report and generate Saved Report data in CSV through Suitelet using Session id but it is throwing me “Must login to Netsuite” error.
Can anyone help on this
This is a cached copy. Click here to see the original post. -
December 27, 2016 at 2:27 pm #5652
chanarbonHi sravanm
For this one, how do you access the Suitelet? Are you accessing the Suitelet through an external application using the system domain instead of the forms domain. Or are you calling it through an nlapiRequestURL() on a server script and user a session id that you have retrieved from a UI session? Or are you getting the headers from the nlobjRequest and call the report in the system domain using nlapiRequestURL()?
-
December 27, 2016 at 11:21 pm #5653
sravanmHi Chanarbon,
Thanks for your response. In Netsuite, I am displaying suite-let link to access it. In Suite-let, I am trying to access report data using nlapiRequestURL api. Following is sample code.
var sessionID = request.getParameter(‘custpage_cookie’);
var reportID=XXXX;
var NETSUITE_REPORT_URL = ‘https://system.sandbox.netsuite.com/app/reporting/reportrunner.nl’;
var authenticationHeaders = new Array();
authenticationHeaders[‘Host’] = ‘https://system.sandbox.netsuite.com’;
authenticationHeaders[‘User-Agent-x’] = nlapiEscapeXML(‘SuiteScript-Call’);
authenticationHeaders[‘Accept’] = nlapiEscapeXML(‘application/xml’);
authenticationHeaders[‘Accept-Language’] = nlapiEscapeXML(‘en-us’);
authenticationHeaders[‘Cookie’] = sessionCookie;
authenticationHeaders[‘Content-Type’] = nlapiEscapeXML(‘application/x-www-form-urlencoded; charset=UTF-8’);
var sessionCookie = ‘JSESSIONID=’ + nlapiEscapeXML(sessionID) + ‘;’ + ‘lastUser=AccountId:-1:_-5_3;NS_VER=2016.2.0’ ;
var initialReportRequestURL = NETSUITE_REPORT_URL + ‘?cr=’ + reportID;
var responseObjectGenerateReport = nlapiRequestURL(initialReportRequestURL, null, authenticationHeaders);
Do let me know if anything need to be added/modified
-
January 3, 2017 at 2:57 am #5654
chanarbonHi @sravanm
From my point of view, the problem is to where you are sourcing the session id. Have you tried sourcing it from the session object of the request or have you retrieved the cookie header of the request itself.
-
AuthorPosts
You must be logged in to reply to this topic.