This topic contains 4 replies, has 0 voices, and was last updated by volneiferreira 7 years, 3 months ago.
-
AuthorPosts
-
July 27, 2017 at 4:17 am #18340
jmacdonaldHello,
I am trying to call a suitelet from within a UE script and I’m running into some weird errors. I generate the url by using url.resolveDomain and url.resolveScript and then use https.get to make the call. The response returned is the NetSuite login page with the message “Your session has timed out. Please log in again.” I have tried everything I can think of to get this to work, using http instead of https, running as admin, making available without login and deploying to all roles. Is there something I’m missing? anyone have any ideas?
Cheers, Jamie.
This is a cached copy. Click here to see the original post. -
July 27, 2017 at 12:05 pm #18341
volneiferreiraWhich entry point of UE are you trying call the suitelet?
In beforeLoad I did a simple test and work fine:
Code:
var urlToCall = url.resolveScript({
scriptId: ‘customscript_test’,
deploymentId: ‘customdeploy_test’,
returnExternalUrl: true
});log.debug({
title: ‘urlToCall’,
details: urlToCall
});var response = https.get({
url: urlToCall
});log.debug({
title: ‘Client Response Body’,
details: response.body
}); -
July 28, 2017 at 1:47 am #18342
jmacdonaldOriginally posted by volneiferreira
View Post
Which entry point of UE are you trying call the suitelet?
I’m using beforeSubmit @volneiferreira
Code:
// Get the domain for the https callvar domain = url.resolveDomain({
hostType: url.HostType.APPLICATION
});
log.debug(‘domain’, domain);
// Get the URL for the suitelet
var csvGenerationUrl = url.resolveScript({
scriptId: ‘customscript_neteur002_sl_generatecsv’,
deploymentId: ‘customdeploy_neteur002_sl_generatecsv’,
params: {
contractid : contractId
}
});log.debug(‘csvGenerationUrl’, csvGenerationUrl);
var link = “https://” + domain + csvGenerationUrl;
log.debug(‘link’, link);
// Http call to suitelet
var success = https.get({
url: link
});
I would prefer to call this using the internal url, should I instead be using the external url if this is from a script? -
July 28, 2017 at 4:54 am #18343
jmacdonaldI tried using the external url and found it worked. Not sure what I was doing wrong trying the internal url but oh well, at least it works now. Thanks for the code example!
-
July 28, 2017 at 6:31 am #18344
volneiferreiraI’m not sure why it only works with the external url but you could create a library that was used by Suitelet and UserEvent
instead.
-
AuthorPosts
You must be logged in to reply to this topic.