I have a suitlet with a select field that sources ...
# suitescript
n
I have a suitlet with a select field that sources from a netsuite list that is placed in a sublist in the suitelet. When I click on the dropdown and then click "list" to see options. Nothing happens. No error, it just doesn't show the list.
b
netsuite uses a get to the suitelet to get the select options
make sure your suitelet responds to that get with the same form
n
not sure I follow @battk I have this at the bottom of the script
Copy code
context.response.writePage(form);
b
log the incoming request in your suitelet
look at the logs before and after you click list
n
Looks to be the same one
with some added parameters
b
your suitelet needs to return the same form that it returned originally
to that request with added parameters
n
so you are saying it shouldn't be the one with added parameters or is fine
b
im saying that your suitelet had to do the same thing for both get requests
i could be more specific if you shared the code
n
test.js
line like 258 is the select that has issues
b
Copy code
if (!wo.defaultValue) {
  return;
}
that doesnt write the same form
n
added that in cause another error was showing but it was happening before that line was added
b
you have multiple places that are conditional on the request having parameters
that will not be the case for the list's get
n
so when the select does a get for the list and there are no params it has issues
b
correct
n
ah okay. didn't realize selects do a get request when they have a source to a list in netsuite
@battk This is the original request when page is loaded: {"type":"http.ServerRequest","method":"POST","url":"https://tstdrv2311829.app.netsuite.com/app/site/hosting/scriptlet.nl","parameters":{"submitter":"Submit","wfinstances":"","_button":"","nsapiFC":"","custpage_parts":"13-1258R","nsapiLI":"","custpage_step":"2","wfVF":"","externalid":"","custpage_customer":"1542","custpage_parts_status_display":"1 - Requested","_eml_nkey_":"TSTDRV2311829~1669~3~N","type":"suitescriptform","nsapiPS":"","deploy":"1","nsapiRC":"","nsapiCT":"1630080538030","customwhence":"","nsapiVF":"","nsapiVD":"","custpage_parts_status":"1","nsbrowserenv":"istop=T","nsapiPI":"","clickedback":"","wfSR":"","nsapiLC":"","id":"","nsapiVL":"","nsapiVI":"","nsapiPD":"","nsapiSR":"","wfPS":"","whence":"/app/site/hosting/scriptlet.nl","entryformquerystring":"script=585&deploy=1&compid=TSTDRV2311829&custpage_wo=10549","_csrf":"fCkx5E0B_fQYGqunSJikfWEOhLmE1OdWMyKj-JsiVx1WnBjUtwag6AKdx0xM1HwkfS39WdJagfkmQswGPKco4W5Di2Kf9nPmO1suZF3G9QwxXnF51oDBCkFpNalm0RNjCVrUPynxJ2LyQKBVgRk9SzR-bFaeJEnV3S4NboOX1F0=","custpage_job":"187","custpage_job_send":"187","script":"585","custpage_location":"2","formdisplayview":"NONE","submitted":"T","_multibtnstate_":"","custpage_wo":"10549","wfFC":"","selectedtab":"","wfPI":""},"header...
Here is when you click on list:
{"type":"http.ServerRequest","method":"GET","url":"https://tstdrv2311829.app.netsuite.com/app/site/hosting/scriptlet.nl","parameters":{"q":"custpage_status","ln":"1","t":"custpage_list2:custpage_status","machine":"custpage_list2","l":"T","script":"585","deploy":"1"},"headers":{"referer":"https://tstdrv2311829.app.netsuite.com/app/site/hosting/scriptlet.nl","User-Agent":"Mozilla/5.0 (....
b
nothing good comes from returning another form on a post
that said, what i said about returning the same form is not entirely true
you need to return a form with the field that its asking for
which is what you may have to end up doing
n
how would I do that exactly?
b
my personal recomendation remains to return the same form, or rewrite your logic so that it returns mostly the same form
n
sorry for the clarification, but when you say "return the same form" are you referring to the line here: context.response.writePage(form);
b
no
all those addFields and addSublist calls are modifying the form
you need to return that same modified form
you can be more targeted if you want, you only need to make modifications related to the field in the GET
n
I thought that is what was happneing. It's the same form element created from beginning that is being returned on writePage. is it not?
b
it isnt, your code is branching on parameters that dont exist
n
so where I have the if, else, else if
b
again, your code is too long and ugly
but as far as i can tell, it returns multiple different forms
and relies on request parameters to determine which form to return
that logic fails for the select field
since you have to figure out which form to return based on a request parameter that wont have a value
n
That makes sense and I think I get it now. I'll do some testing. Really appreciate the help