Hello All :wave: I am having an issue with a clie...
# suitescript
s
Hello All 👋 I am having an issue with a client script on a suitelet. I have an external Suitelet that accepts a few inputs from the user, runs a saved search, and then returns the search results as a list. If the request is a GET, I create a form for the user. I have added a client script to the form using
form.clientScriptModulePath
and this is working fine. When the user submits the form with a POST, the Suitelet returns a list to the user. When I try adding a client script to the list using the same method,
list.clientScriptModulePath
, I get a SuiteScript error. The error is "Your connection has timed out. Please <a href='/pages/login.jsp' target='_self'>log in</a> again." I also get the same error when using
list.clientScriptFileId
Any ideas why I can add a client script on the form but get this error when adding a client script on the list?
b
i wouldnt expect that from an externally available suitelet
what does the rest of the code look like
s
I set the client script on the form like this
Copy code
// create a new form
        let form = serverWidget.createForm({
          title: 'External Suitelet',
          hideNavBar: true
        });

        // set the client script
        form.clientScriptModulePath = './BSL_2.1_Client_ExternalSearch_Form.js';
I then add some fields to the form and use
context.response.writePage(form);
to show the form. This is the part that is working without issues. I set the client script on the list like this
Copy code
let list = serverWidget.createList({
      title: 'An External Suitelet List'
    });
    list.clientScriptModulePath = './BSL_2.1_Client_ExternalSearch_List.js';
   
    list.addButton({
      id: 'custpage_btn_goback',
      label: 'Go Back',
      functionName: `goBack`
    });
This returns the error that I mentioned earlier. This is the client script that I am trying to add to the list (just testing an alert right now)
Copy code
define([], function () {
  let exports = {};

  function pageInit(context) {
    // TODO
  }

  function goBack() {
    alert('The Go Back button was clicked.');
  }

  exports.pageInit = pageInit;
  exports.goBack = goBack;
  return exports;
});
140 Views