Hi all, I'm very new to SuiteScript and I'm strugg...
# suitescript
m
Hi all, I'm very new to SuiteScript and I'm struggling with something hope somebody knows the answer. Any help is appreciated. Here are the details: 1. Adding a tab 2. Adding a sublist 3. Adding 30 elements into the sublist 4. Pagination is not updating list after selecting
Copy code
const subTab = form.addTab({
    id: "custpage_tab_mehmet",
    label: "MTab",
  });

  const subList = form.addSublist({
    id: "custpage_sublist_mehmet",
    label: "MSublist",
    tab: "custpage_tab_mehmet",
    type: ui.SublistType.STATICLIST
  });

  subList.addField({
    id: "custpage_column_one",
    label: "Col 1",
    type: ui.FieldType.TEXT
  })

  for (let index = 0; index < 30; index++) {
    subList.setSublistValue({
      id: "custpage_column_one",
      line: index,
      value: `col1 row${index}`
    });
  }
b
what does the rest of the code look like
m
Copy code
export let beforeLoad: EntryPoints.UserEvent.beforeLoad = (
  context: EntryPoints.UserEvent.beforeLoadContext
): void => {

  let form = context.form;
  // Above code goes here.
}
This is pretty much it.
b
works for me
although its really a guess, you still havent shared the actual code
message has been deleted
m
@battk I really appreciate your time! Here is the whole ts file.
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 */

import { EntryPoints } from "N/types";
import * as ui from "N/ui/serverWidget";

export let beforeLoad: EntryPoints.UserEvent.beforeLoad = (
  context: EntryPoints.UserEvent.beforeLoadContext
): void => {
  let form = context.form;
  const subTab = form.addTab({
    id: "custpage_tab_mehmet",
    label: "MTab",
  });

  const subList = form.addSublist({
    id: "custpage_sublist_mehmet",
    label: "MSublist",
    tab: "custpage_tab_mehmet",
    type: ui.SublistType.STATICLIST
  });

  subList.addField({
    id: "custpage_column_one",
    label: "Col 1",
    type: ui.FieldType.TEXT
  })

  for (let index = 0; index < 30; index++) {
    subList.setSublistValue({
      id: "custpage_column_one",
      line: index,
      value: `col1 row${index}`
    });
  }
};
I wonder if this is a version issue
b
give the actual javascript
m
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 * @NAmdConfig ./JsLibraryConfig.json
 */
define(["require", "exports", "N/ui/serverWidget"], function (require, exports, ui) {
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.beforeLoad = function (context) {
        var form = context.form;
        var subTab = form.addTab({
            id: "custpage_tab_mehmet",
            label: "MTab",
        });
        var subList = form.addSublist({
            id: "custpage_sublist_mehmet",
            label: "MSublist",
            tab: "custpage_tab_mehmet",
            type: ui.SublistType.STATICLIST
        });
        subList.addField({
            id: "custpage_column_one",
            label: "Col 1",
            type: ui.FieldType.TEXT
        });
        for (var index = 0; index < 30; index++) {
            subList.setSublistValue({
                id: "custpage_column_one",
                line: index,
                value: "col1 row" + index
            });
        }
    };
});
b
Copy code
* @NAmdConfig ./JsLibraryConfig.json
is missing
m
Copy code
{
  "paths": {
    "crypto-js": "./lib/crypto-js.js",
    "uuid": "./lib/uuid.min.js"
  }
}
This is the contents of JsLibraryConfig.json
b
minor spoiler
you need to share everything
m
😄
b
its probably easier to test it without since it doesnt look like you are actually using it
m
Yeah even if I pulled that out it was still not working for me
b
so far its nothing related to the code you shared
so you want to start looking at other places
a good start would be the debugger
the network tab should contain the request used to get the next page
👍 1
m
Problem resolved. I haven't given
Client
execution context to the script deployment once that was given dropdown started working as expected.
So the issue was not with the code.