This topic contains 6 replies, has 0 voices, and was last updated by cblackburn 8 years ago.
-
AuthorPosts
-
October 19, 2016 at 1:46 pm #1658
MChammaTXI’m getting this really weird error when I’m uploading my script : “Fail to evaluate script: All SuiteScript API Modules are unavailable while executing your define callback.”
It seems like maybe it is a problem with my define statement but I can’t spot the issue. My code is:
Code:
/**
* @NApiVersion 2.0
* @NScriptType mapreducescript
*/define([‘N/search’, ‘N/record’, ‘N/email’, ‘N/runtime’],
function (search, record, email, runtime)
{
var PARAMS = getParams();
function getParams()
{
var retData = {};
var currScript = runtime.getCurrentScript();
retData.inactivate = currScript.getParameter(‘custscript_its_data_wiz_inactivate’);
retData.searchid = currScript.getParameter(‘custscript_its_data_wiz_ssid’);
return retData;
}
function getInputData(context)
{
return search.load({ id: PARAMS.searchid });
}
function map(context)
{
log.audit(“map entry”, context.key + “|” + context.value + “|” + JSON.stringify(PARAMS));
}
function summarize(summary)
{
log.audit(“summarize”, “done”);
}
return {
getInputData: getInputData,
map: map,
summarize: summarize
}}
);
This is a cached copy. Click here to see the original post. -
October 19, 2016 at 1:53 pm #1659
MChammaTXOk never mind. It seems like I can’t run the getParams function globally it has to be within a map reduce stage function.
david.smith replied on 10/19/2016, 02:09 PM: I think I ran into that same thing before.
-
October 20, 2016 at 12:01 am #1660
chanarbonHi @MChammaTX
Yup. The concept is that the process is divided through stages that functions are only called during the instance that their respective entry points get triggered in the process
-
October 20, 2016 at 9:07 am #1661
ironsideI have seen this error as well – on perfectly functional code. Whatever parsing engine they are passing things through does not handle advanced custom libraries very well.
-
October 21, 2016 at 1:53 pm #1662
cblackburnThe rule is that the “constructor” (i.e. define callback function) cannot make API calls, in order to prevent unintentional execution of the business logic when the module is being loaded and/or analyzed. This can only happen during script creation or update.
Originally posted by ironside
View Post
I have seen this error as well – on perfectly functional code. Whatever parsing engine they are passing things through does not handle advanced custom libraries very well.
ironside, would you be able to provide an example of an advanced module which was not handled well?
-
October 26, 2016 at 10:48 am #1663
ironsideNFT-SS2
ironside, would you be able to provide an example of an advanced module which was not handled well?[/QUOTE]
-
October 27, 2016 at 12:07 pm #1664
cblackburnOriginally posted by ironside
View Post
NFT-SS2
ironside, would you be able to provide an example of an advanced module which was not handled well?
[/QUOTE]
“Example.ts” in the linked page is TypeScript, do you have the transpiled JavaScript version of the example available anywhere?
ironside replied on 11/02/2016, 09:24 AM: Building NFT is the best way to get the JS. I recommend giving it a try (independent of this NS issue)!
-
AuthorPosts
You must be logged in to reply to this topic.