RE: How to open a suitelet after record is submited

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,
  };
});

 

Maira S Beginner Asked on October 27, 2023 in SuiteScript.
Add Comment
1 Answers

Hi. Could you please clarify what behaviour you are currently experiencing? What is the Suitelet doing?

Intermediate Answered on November 5, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.