RE: How to open a suitelet after record is created
I want open a suitelet once record is created. I am trying with user event after submit. but its either creating record or redirecting to suitelet. Please help!
/**
*@NApiVersion 2.1
*@NScriptType UserEventScript
*/
define([
“N/runtime”,
“N/ui/serverWidget”,
“N/search”,
“N/file”,
“N/http”,
“N/url”,
“N/https”,
“N/redirect”
], function (runtime, serverWidget, search, file, http, url, https, redirect) {
function afterSubmit(context) {
log.debug(“context.type”,context.type);
if (context.type === ‘create’)
{
try {
var currentScript = runtime.getCurrentScript();
var o_form = context.form;
var recordObj = context.newRecord;
log.debug(“recordObj”,recordObj);
var recordId = context.newRecord.id;
log.debug(“recordId–>”,recordId);
redirect.toSuitelet({
scriptId: ‘customscript_sut_create_wave_progress’,
deploymentId: ‘customdeploy_sut_create_wave_progress’,
parameters: {
‘custscript_i_standard_wave_id1’:recordId
}
});
log.debug(“suiteurl”,suiteurl);
} catch (exp) {
log.debug({
title: “Éxception in afterSubmit() function”,
details: exp.toString(),
});
}
}
}
return {
afterSubmit: afterSubmit,
};
});
Hi. Could you please clarify what behaviour you are currently experiencing? What is the Suitelet doing?