Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (11.9k points)

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 salesforce. This requires to get URL ' https://system.na1.netsuite.com' via suite script. 'na1' in URL stands for Noth America and this changes in URL according to the country. Hence bypassing email id, password to the actual login address 'https://system.netsuite.com/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?

1 Answer

0 votes
by (32.1k points)

In addition, instead of systemDomainrestDomain and webservicesDomain is also available. This is an example of calling the RESTlet from NetSuite, but it can be done in any language.

So, the user profiles and objects are actually considered "objects which are used to manage your organization" and they can be accessed without any bad consequences of whether or not your test class/method includes the... annotation

Objects which are accessible in this manner include:

RecordType

ApexTrigger

Organization

ApexComponentfunction credentials(){

        this.email = "[email protected]";

        this.account = "1234567";

        this.role = "25";

        this.password = "secretPassword";

    }

    //Setting up URL              

    var url = "https://rest.netsuite.com/rest/roles";

    //Calling credential function

    var cred = new credentials();

    //Setting up Headers 

    var headers = {"User-Agent-x": "SuiteScript-Call",

                   "Authorization": "NLAuth nlauth_account=" + cred.account + ", nlauth_email=" + cred.email + 

                                    ", nlauth_signature= " + cred.password + ", nlauth_role=" + cred.role,

                   "Content-Type": "application/json"};

    var response = nlapiRequestURL(url, null, headers);

    var results = JSON.parse(response.body);

    var domain = results[0].dataCenterURLs.systemDomain;

ApexClass

ApexPage

Browse Categories

...