I need to access the sales order in Netsuite from SFDC login. I already have the code that gets the sales order number. My problem is I need to generate the URL to redirect to sales order in NetSuite from sales force. This requires get url ' ' via suitescript .
'na1' in url stands for Noth America and this changes in url according to the country.
Hence by passing email id, password to the actual login address '.jsp' I need to get the authorized url.
nlapiResolveURL(type, identifier, id, displayMode)
Creates a URL on-the-fly for later part of the url.
any idea or solution please?
I need to access the sales order in Netsuite from SFDC login. I already have the code that gets the sales order number. My problem is I need to generate the URL to redirect to sales order in NetSuite from sales force. This requires get url ' https://system.na1suite.' via suitescript .
'na1' in url stands for Noth America and this changes in url according to the country.
Hence by passing email id, password to the actual login address 'https://systemsuite./pages/customerlogin.jsp' I need to get the authorized url.
nlapiResolveURL(type, identifier, id, displayMode)
Creates a URL on-the-fly for later part of the url.
any idea or solution please?
Share Improve this question edited Apr 23, 2015 at 9:21 gs11111 asked Apr 23, 2015 at 9:08 gs11111gs11111 6592 gold badges17 silver badges49 bronze badges 4- Just a clarification, you need to generate the URL of the SO of NS from the SFDC? – vVinceth Commented Apr 23, 2015 at 9:32
- YES, I get the sales order's internal id in SFDC. URL generating is problem – gs11111 Commented Apr 23, 2015 at 9:34
- How are you getting the internal id of the SO in NS from SF? Are your NS and SF SO records are synchronized? – vVinceth Commented Apr 23, 2015 at 9:38
- I get internal id using a restlet – gs11111 Commented Apr 23, 2015 at 10:26
3 Answers
Reset to default 3Expanding on the answer posted by @egrubaugh360, to get the base domain, here is an example.
var credentials = {
email: "[email protected]",
account: "1234567",
role: "25",
password: "secretPassword",
};
//Setting up URL
var url = "https://restsuite./rest/roles";
//Setting up Headers
var headers = {"User-Agent-x": "SuiteScript-Call",
"Authorization": "NLAuth nlauth_account=" + credentials.account + ", nlauth_email=" + credentials.email +
", nlauth_signature= " + credentials.password + ", nlauth_role=" + credentials.role,
"Content-Type": "application/json"};
var response = nlapiRequestURL(url, null, headers);
var results = JSON.parse(response.body);
var domain = results[0].dataCenterURLs.systemDomain;
In addition, instead of systemDomain
, restDomain
, and webservicesDomain
is also available. This is an example of calling the RESTlet from NetSuite, but it can be done in any language.
If you're already retrieving the ID from a RESTlet, just add the URL to your return object from the RESTlet. You should be able to generate the URL using nlapiResolveURL
as you pointed out. It should look something like this:
var url = nlapiResolveURL('RECORD', 'salesorder', 1234);
where 1234
is the actual Sales Order ID. This will set url
to something like
/app/accounting/transactions/salesorder.nl?id=1234
In order to get the base domain, you will need to use NetSuite's Role Service in addition to using your RESTlet. You can see the NetSuite Help document titled Using the REST roles Service to Get User Accounts, Roles, and Domains. This is really simply a RESTlet provided by NetSuite that lets you pass in a username and password and will return to you all of the accounts and roles to which that user has access. The result includes the proper REST domain for that account via the restDomain
property.
Also, for clarification, the na1
in the URL does not necessarily change based on country but more specifically based on the data center on which that client account is hosted.
What I would generally do for something like this would be to create a Suitelet or RESTLet to return all the order information. A RESTLet can return the order details in JSON format and you could use that to format the order with your own view.
A Suitelet can be produced that is accessed via a shareable url where part of the URL query string is the order internal id (or order number) and a time limited access token.
You can pretty easily use Netsuite's scriptable templates to display the formatted sales order. If you need to edit the order for some reason things bee a little trickier. Minor editing can be done more efficiently (say approve/reject and a reason code) using the Suitelet but if you want people to be able to do arbitrary edits then you'd need to have your suitelet log them in and redirect them to the customer center.
The best way to do that so far is to use SAML or inbound Single-Sign-On for the authentication part. It looks like you should be able to do OpenId to access the customer center but I haven't done that yet so don't know what pitfalls there might be going that route.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745037990a4607636.html
评论列表(0条)