can you start again

here is the script that needs to be modified by the additon of prev and next buttons as well as the addition of pagination so that only 100 results are displayed
/\*\*
 \* @NApiVersion 2.x
 \* @NScriptType Suitelet
 \* @NModuleScope SameAccount
 \*/

define(['N/ui/serverWidget', 'N/search','N/runtime'], function(ui, search,runtime) {
 function onRequest(context) {
 if (context.request.method === 'GET') {
 var form = ui.createForm({
 title: 'Sales Orders Search',
 });

 var customerGroupField = form.addField({
 id: "custgroup\_filter",
 type: ui.FieldType.SELECT,
 label: "Customer Group",
 source: "customerGroup",
 });
 customerGroupField.isMandatory = false;

 var customerField = form.addField({
 id: "customer\_filter",
 type: ui.FieldType.SELECT,
 label: "Customer",
 source: "customer",
 });
 customerField.isMandatory = false;

 var startDateField = form.addField({
 id: "start\_date\_filter",
 type: ui.FieldType.DATE,
 label: "Start Date",
 });
 startDateField.isMandatory = false;

 var endDateField = form.addField({
 id: "end\_date\_filter",
 type: ui.FieldType.DATE,
 label: "End Date",
 });
 endDateField.isMandatory = false;

 var savedSearchField = form.addField({
 id: "saved\_search\_filter",
 type: ui.FieldType.SELECT,
 label: "Saved Search",
 source: "search",
 });

 form.addSubmitButton({
 label: 'Search',
 });

 context.response.writePage(form);

 } else {

 var salesOrderSearch = search.create({
 type: search.Type.SALES\_ORDER,
 columns: [
 'tranid',
 'entity',
 'trandate',
 'status',
 ],
 });

 var filters = [];
 var createdDate = context.request.parameters.created\_date;
 var status = context.request.parameters.status;
 var customer = context.request.parameters.customer;
 var customerGroupId = context.request.parameters.customer\_group;

 if (createdDate) {
 filters.push(['createddate', 'onorafter', createdDate]);
 }

 if (status) {
 filters.push(['status', 'anyof', status]);
 }

 if (customer) {
 filters.push(['entity', 'anyof', customer]);
 }

 if (customerGroupId) {
 salesOrderSearch.filters.push(['custbody\_customer\_group', 'anyof', customerGroupId]);
 }

 salesOrderSearch.filters = filters;

 var searchResult = salesOrderSearch.run();

 var form = ui.createForm({
 title: 'Sales Orders Search',
 });

 var sublist = form.addSublist({
 id: 'salesorders',
 label: 'Sales Orders',
 type: ui.SublistType.LIST,
 });

 sublist.addField({
 id: 'sales\_order\_id',
 label: 'Sales Order ID',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: 'customer\_name',
 label: 'Customer Name',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: 'created\_date',
 label: 'Created Date',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: 'status',
 label: 'Status',
 type: ui.FieldType.TEXT,
 });

 var i = 0;
searchResult.each(function(result) {
 sublist.setSublistValue({
 id: 'sales\_order\_id',
 line: i,
 value: result.getValue({
 name: 'tranid',
 }),
 });
 sublist.setSublistValue({
 id: 'customer\_name',
 line: i,
 value: result.getText({
 name: 'entity',
 }),
 });
 sublist.setSublistValue({
 id: 'created\_date',
 line: i,
 value: result.getValue({
 name: 'trandate',
 }),
 });
 sublist.setSublistValue({
 id: 'status',
 line: i,
 value: result.getText({
 name: 'status',
 }),
 });
 i++;
 return true;
});
var pageSize = 20;
var currentPage = 0;
var maxPages = 0;
var numResults = 0;
searchResult.each(function(result) {
 numResults++;
});

if (numResults > 0) {
 maxPages = Math.ceil(numResults / pageSize);
}

if (context.request.method === 'POST') {
 if (context.request.parameters.next\_page) {
 currentPage++;
 } else if (context.request.parameters.prev\_page) {
 currentPage--;
 }
}

var startIndex = currentPage \* pageSize;
var endIndex = (currentPage + 1) \* pageSize;

searchResult.getRange({
 start: startIndex,
 end: endIndex
}).forEach(function(result) {
 sublist.setSublistValue({
 id: 'sales\_order\_id',
 line: i,
 value: result.getValue({
 name: 'tranid',
 }),
 });
 sublist.setSublistValue({
 id: 'customer\_name',
 line: i,
 value: result.getText({
 name: 'entity',
 }),
 });
 sublist.setSublistValue({
 id: 'created\_date',
 line: i,
 value: result.getValue({
 name: 'trandate',
 }),
 });
 sublist.setSublistValue({
 id: 'status',
 line: i,
 value: result.getText({
 name: 'status',
 }),
 });
 i++;
});

// Add pagination buttons
if (currentPage > 0) {
 form.addButton({
 id: 'prev\_page',
 label: 'Previous Page',
 functionName: 'onPrevPageClick'
 });
}
if (currentPage < maxPages - 1) {
 form.addButton({
 id: 'next\_page',
 label: 'Next Page',
 functionName: 'onNextPageClick'
 });
}

// Add client script to handle pagination button clicks
var clientScript = "function onPrevPageClick() {\n" +
 " var form = document.getElementById('main\_form');\n" +
 " form.prev\_page.value = 'T';\n" +
 " form.submit();\n" +
 "}\n" +
 "function onNextPageClick() {\n" +
 " var form = document.getElementById('main\_form');\n" +
 " form.next\_page.value = 'T';\n" +
 " form.submit();\n" +
 "}";
form.clientScriptModulePath = './' + runtime.getCurrentScript().id + '\_client.js';

// Set hidden fields for pagination
var prevPageField = form.addField({
 id: 'prev\_page',
 type: ui.FieldType.TEXT,
 label: 'Prev Page',
 displayType: ui.FieldDisplayType.HIDDEN
});
var nextPageField = form.addField({
 id: 'next\_page',
 type: ui.FieldType.TEXT,
 label: 'Next Page',
 displayType: ui.FieldDisplayType.HIDDEN
});

// Add submit button
form.addSubmitButton({
 label: 'Search'
});

// Write the form to the response
context.response.writePage(form);
 }
 }
 return {
 onRequest: onRequest,
 };
});
다시 시작합니다.

다음은 이전 및 다음 버튼을 추가하고 페이지 매김을 추가하여 100 개의 결과 만 표시되도록 수정해야하는 스크립트입니다.
/\*\*
 \* @NApiVersion 2.x
 \* @NScriptType Suitelet
 \* @NModuleScope SameAccount
 \*/

define(['N/ui/serverWidget', 'N/search', 'N/runtime'], function(ui, search,runtime) {
 function onRequest(context) {
 if (context.request.method === 'GET') {
 var form = ui.createForm({
 title: '판매 주문 검색',
 });

 var customerGroupField = form.addField({
 id: "custgroup\_filter",
 유형: ui.FieldType.SELECT,
 label: "고객 그룹",
 source: "customerGroup",
 });
 customerGroupField.isMandatory = false;

 var customerField = form.addField({
 id: "customer\_filter",
 유형: ui.FieldType.SELECT,
 label: "Customer",
 source: "customer",
 });
 customerField.isMandatory = false;

 var startDateField = form.addField({
 id: "start\_date\_filter",
 유형: ui.FieldType.DATE,
 label: "시작 날짜",
 });
 startDateField.isMandatory = false;

 var endDateField = form.addField({
 id: "end\_date\_filter",
 유형: ui.FieldType.DATE,
 label: "종료 날짜",
 });
 endDateField.isMandatory = false;

 var savedSearchField = form.addField({
 id: "saved\_search\_filter",
 유형: ui.FieldType.SELECT,
 label: "저장된 검색",
 source: "검색",
 });

 form.addSubmitButton({
 레이블: '검색',
 });

 context.response.writePage(form);

 } else {

 var salesOrderSearch = search.create({
 유형: search.Type.SALES\_ORDER,
 columns: [
 'tranid',
 'entity',
 '트란다테',
 'status',
 ],
 });

 var filters = [];
 var createdDate = context.request.parameters.created\_date;
 var status = context.request.parameters.status;
 var customer = context.request.parameters.customer;
 var customerGroupId = context.request.parameters.customer\_group;

 if (createdDate) {
 filters.push(['createddate', 'onorafter', createdDate]);
 }

 if (status) {
 filters.push(['status', 'anyof', status]);
 }

 if (customer) {
 filters.push(['entity', 'anyof', customer]);
 }

 if (customerGroupId) {
 salesOrderSearch.filters.push(['custbody\_customer\_group', 'anyof', customerGroupId]);
 }

 salesOrderSearch.filters = filters;

 var searchResult = salesOrderSearch.run();

 var form = ui.createForm({
 제목: '판매 주문 검색',
 });

 var sublist = form.addSublist({
 id: 'salesorders',
 label: '판매 주문',
 유형: ui.SublistType.LIST,
 });

 sublist.addField({
 id: 'sales\_order\_id',
 label: '판매 주문 ID',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: '고객\_이름',
 label: '고객 이름',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: 'created\_date',
 label: '생성된 날짜',
 type: ui.FieldType.TEXT,
 });

 sublist.addField({
 id: '상태',
 label: '상태',
 type: ui.FieldType.TEXT,
 });

 var i = 0;
searchResult.each(function(result) {
 sublist.setSublistValue({
 id: 'sales\_order\_id',
 line: i,
 value: result.getValue({
 name: 'tranid',
 }),
 });
 sublist.setSublistValue({
 id: 'customer\_name',
 line: i,
 value: result.getText({
 name: 'entity',
 }),
 });
 sublist.setSublistValue({
 id: 'created\_date',
 line: i,
 value: result.getValue({
 name: 'trandate',
 }),
 });
 sublist.setSublistValue({
 id: 'status',
 line: i,
 value: result.getText({
 name: 'status',
 }),
 });
 i++;
 참을 반환합니다;
});
var pageSize = 20;
var currentPage = 0;
var maxPages = 0;
var numResults = 0;
searchResult.each(function(result) {
 numResults++;
});

if (numResults > 0) {
 maxPages = Math.ceil(numResults / pageSize);
}

if (context.request.method === 'POST') {
 if (context.request.parameters.next\_page) {
 currentPage++;
 } else if (context.request.parameters.prev\_page) {
 currentPage--;
 }
}

var startIndex = currentPage \* pageSize;
var endIndex = (currentPage + 1) \* pageSize;

searchResult.getRange({
 start: startIndex,
 end: endIndex
}).forEach(function(result) {
 sublist.setSublistValue({
 id: 'sales\_order\_id',
 line: i,
 value: result.getValue({
 name: 'tranid',
 }),
 });
 sublist.setSublistValue({
 id: 'customer\_name',
 line: i,
 value: result.getText({
 name: 'entity',
 }),
 });
 sublist.setSublistValue({
 id: 'created\_date',
 line: i,
 value: result.getValue({
 name: 'trandate',
 }),
 });
 sublist.setSublistValue({
 id: 'status',
 line: i,
 value: result.getText({
 name: 'status',
 }),
 });
 i++;
});

// 페이지 매김 버튼 추가
if (currentPage > 0) {
 form.addButton({
 id: 'prev\_page',
 label: '이전 페이지',
 functionName: 'onPrevPageClick'
 });
}
if (currentPage < maxPages - 1) {
 form.addButton({
 id: 'next\_page',
 label: '다음 페이지',
 functionName: 'onNextPageClick'
 });
}

// 페이지 매김 버튼 클릭을 처리하는 클라이언트 스크립트 추가
var clientScript = "function onPrevPageClick() {\n" +
 " var form = document.getElementById('main\_form');\n" +
 " form.prev\_page.value = 'T';\n" +
 " form.submit();\n" +
 "}\n" +
 "function onNextPageClick() {\n" +
 " var form = document.getElementById('main\_form');\n" +
 " form.next\_page.value = 'T';\n" +
 " form.submit();\n" +
 "}";
form.cli