This topic contains 5 replies, has 0 voices, and was last updated by david.smith 7 years, 5 months ago.
-
AuthorPosts
-
November 14, 2016 at 9:12 pm #1546
kikoHi, How do I call a suitelet written in 2.0 on the afterSubmit function (user event) written in 1.0
Note that I also need to pass some parameters to the 2.0 suitelet.
Thanks.
This is a cached copy. Click here to see the original post. -
November 17, 2016 at 11:40 am #1547
david.smithnlapiResolveURL(‘suitelet’……)
nlapiRequestURL(….)
-
November 21, 2016 at 8:31 pm #1548
chanarbonAgreeing with david.smith, you should use nlapiResolveURL() then append the parameters to the result of the resolved URL then perform the request url. But please note that you should have the same data center. This should be just the same on how you call it on 1.0 to 1.0
-
May 22, 2017 at 10:28 pm #1549
eliechanarbon What’s the recommended way to accomplish getting the appropriate data center url? (In a User Event script, not web service)
-
May 24, 2017 at 1:54 pm #1550
david.smithelie You can get the URL in the beforload script context using the server request object.
elie replied on 05/24/2017, 02:36 PM: David,
Are you suggesting storing it in a custom scripted field so that it is accessible on the backend afterSubmit?
Can you share some code? Thanks!
-
May 24, 2017 at 3:17 pm #1551
david.smithCode:
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define([‘N/search’,’N/ui/serverWidget’],
function(search, serverWidget) {function beforeLoad(scriptContext) {
log.debug(‘context’,scriptContext);var form = scriptContext.form;
var hiddenFld = form.addField({
id:”custpage_ns_url”,
label:”Domain URL”,
type:’text’
});
var domain = scriptContext.request.url.replace(/https:///,”).replace(//.+/,”);
hiddenFld.defaultValue = domain;
hiddenFld.updateDisplayType({
displayType : ‘hidden’
});
}function afterSubmit(scriptContext) {
var newRec = scriptContext.newRecord;
log.debug(‘domain’,newRec.getValue({fieldId:’custpage_ns_url’}));
}return {
beforeLoad: beforeLoad,
// beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};});
-
AuthorPosts
You must be logged in to reply to this topic.