Can I take a Transaction custom field of type List...
# suitescript
m
Can I take a Transaction custom field of type List/Record and filter the dropdown values using a Client Script?
n
yes as long as the field is not sourced from a list.
m
@Nathan L Thanks for the response! Im ok with that, what TYPE should the field be?
n
Ah i see what you are saying. Its a custom field you created through the UI. I believe that adding and removing select options from a select field can only be done for fields added through scripting. So for example, you would have a UE script that creates the field with
Copy code
let field = form.addField({
        id: "custpage_myNewList",
        type: serverWidget.FieldType.SELECT,
        label: "My New List"
      });
Then you can populate it with
Copy code
field.addSelectOption({value: 1, text: 'Some Value'});
In either a client or UE (before load) script
m
@Nathan L Perfect! thank for the detailed research. I will try it on my end.
n
👍 Let me know if you run into any hiccups. I have a suitelet right now that im working on that dynamically displays select options, so i have fresh code to reference
👍 1
m
@Nathan L Works perfect for me! ran into a problem that the value doesn't get saved so I created another (Transaction body) field to capture that value.
n
Nice! What I have done before for something like this is UE script creates temp select field and populates with values Hides "real" field Client script updates select options in temp field based on criteria (maybe you don't need this for your use case) Then on beforeSubmit in the UE script, grab the value from the temp field, and set it in the 'real' field
💯 1
m
@Nathan L yup! One small issue still trying to figure out.. the 'temp' field is at the end of the
transaction line item row
by default, im trying to move it to the beginning.
n
ah yeah. thats the unfortunate thing about scripted fields in a sublist. I don't think there is a way to set the position on the sublist.
m
😢 netsuite
💯 1
@Nathan L Bam I hit a major issue. When I do
addSelectOption
it adds the value to the scripted field on every line item, I need to dynamically add different dropdown values depending on the line.
n
Dang that is a tough one. That im not sure is possible. Because when fields are added to a sublist, its added as a column that applies to every line.
🆗 1
m
Yup thanks anyhow!