In Suitescript 1.0 client script, how could we get...
# suitescript
b
In Suitescript 1.0 client script, how could we get all select options for Dropdown field? I tried
Copy code
var field = nlapiGetField('custpage_field_id')
field.getSelectOptions()
But this shows undefined error. I want to clear select field and trying to add new options, I can add using
nlapiInsertSelectOption
and remove
nlapiRemoveSelectOption
but I don't know what options exists
n
what does your field object look like if you output it to the console? Because getSelectOptions() is the same in SS1 as 2.
b
@NElliott When I console it, it looks like this.
It should be dynamic so no source is defined
Also in client script, Can I run
searchRes.getResults(0, 100)
? Because it also throws me the error
n
if you have not set a source and you have not set any options you would not have any select options...
b
But it throws me the error
n
I don't recall it's been a few years since I wrote a search in SS1.0, you'd have to refer to the docs.
Yes it throws an error and I thought maybe your field Object was / is null. It might be throwing an error because you cannot getSelectOptions if there are none? How about you add an option one and then try getSelectOptions. It might be one of those where you need to "catch" if there are no options.
b
Client script version should be matching with Suitelet, right?
n
?
Don't think it matters.
The objects should be the same.