How to get and pass values to the suitelet url from portlet

hi,

I have created 2 select type fields on portlet. How to get and pass those selected values to the suitelet url. Below is my code. Please help!!

/**
 *@NApiVersion 2.x
 *@NScriptType Portlet
 */
// This sample creates a portlet with two links
define([‘N/ui/serverWidget’,’N/url’], function(serverWidget,url) {
  function render(params) {
      var portlet = params.portlet;
      portlet.title = ‘KPI Portlet’;
      var subsidiaryField = params.portlet.addField({
        id: ‘custpage_subsidiary’,
        type: serverWidget.FieldType.SELECT,
        label: ‘Subsidiary’,
        source:’subsidiary’
    });
    var periodField = params.portlet.addField({
      id: ‘period’,
      type: serverWidget.FieldType.SELECT,
      label: ‘Period’,
      source:”
  });
  var outputUrl = url.resolveScript({
    scriptId: ‘customscript_sut_fetch_kpi_group’,
    deploymentId: ‘customdeploy_sut_fetch_kpi_group’,
    params: {
      subsidiary: (“subsidiary and period selected value”),
   }
});
log.debug(“output”,output);
params.portlet.setSubmitButton({
  url: outputUrl,
  label: ‘Submit’,
  target: ‘_top’
});
  }
  return {
      render: render
  };
});

 

Beginner Asked on December 8, 2023 in SuiteScript.
Add Comment
1 Answer(s)

I would suggest you submit the for back to the current Portlet and then use N/redirect to send the user to that Suitelet.

I hope that makes sense.

Chris

Intermediate Answered on December 11, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor