Resubmitting in the “POST” side of a Suitelet

We have a script for a basic inventory lookup tool. However, whenever we use it, we have to click back in the browser to go back to the entry form. I tried copying the form code in the GET portion to both the beginning and end of the POST portion, with the end result that the results page is never showed. Is there a way to make the form show up on the results page and save us a few clicks?

define(['N/record', 'N/ui/serverWidget', 'N/log', 'N/search', 'N/error'], function(record, serverWidget, log, search, error) {

function onRequest(context) {

if (context.request.method === 'GET') {

//Create form if this is the initial pageload

var form = serverWidget.createForm({

title: 'Form title'


var searchgroup = form.addFieldGroup({

id: 'searchgroup',

label: 'Search Group Label'


var searchfield = form.addField({

id: 'searchfield',

type: serverWidget.FieldType.TEXT,

label: 'Search Field Label',

//container: 'searchcontainer'



label: 'Submit',




else {
//First place we tried copy/pasting form from above
//other code for lookup


//other code for display and logging, lot of context.writes.

//Second place we tried copy/pasting form from above.


return {

onRequest: onRequest



Is this possible? Do I need to look into making the results a sublist instead of just writing them out?

Rookie Asked on November 12, 2021 in SuiteScript.
Add Comment
0 Answer(s)

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