Sim Greenbaum
11/13/2024, 7:20 PMCeligo AI
11/13/2024, 7:20 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that a Client Script can be triggered inside a Suitelet in NetSuite. However, this is not a straightforward process and requires specific steps to be followed. Here's a general approach: 1. In your User Event Script's
beforeLoad
function, add a button to the form and specify the path to the client script with the function(s) in it. You can use form.addButton
to add a button and form.clientScriptModulePath
to specify the client script.
javascript
const printButton = form.addButton({
id: "custpage_custom_button1",
label: "Something",
functionName: "callSuitlet",
});
form.clientScriptModulePath = "./OpenSuiteClientScript.js";
2. In your Client Script, define the function that should be executed when the button is clicked. This function should be separate from pageInit
and returned like any other entry point function.
javascript
function callSuitlet() {
try {
log.debug("this is firing", suiteletUrl);
// call the suitelet
const suiteletUrl = url.resolveScript({
scriptId: "customscript1197",
params: {},
returnExternalUrl: false,
});
// load the suitelet in the browser
window.open("<https://www.google.com>");
} catch (e) {
log.error({ title: "error in callSuitelet", details: e });
}
}
return {
callSuitlet: callSuitlet
};
Please note that you do not need to deploy the client script if it's only providing button function functionality.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
11/13/2024, 7:20 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832232416
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831565
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82899791
Celigo AI
11/13/2024, 7:20 PM