I’ve created and populated a sublist on a sales or...
# suitescript
e
I’ve created and populated a sublist on a sales order form and I’m trying to update the sublist based on a field change event on the customer dropdown list on a client-side script. The standard setCurrentSublistValue method isn’t working as expected. Anyone have a secret formula? It looks to me that behind the scenes, the sublist rows and being updated BUT the sublist grid on the page isn’t being refreshed.
b
What does the code look like
e
This is the code on the populateSublist function. There doesn’t seem to be a way to access the form using context.form like I can on the UE script so I’m using thisRecord to access the sublist.
b
e
I just added forceSyncSourcing and it’s still not working as expected.
b
What does the code that creates the sublist look like
e
where form = context.form on the UE beforeLoad function triggered on the user interface context.
b
wrong sublist type for the code you have
pick a sublist type that supports adding lines
if you still want a list, then you need to add all your lines in your user event
if you want to change list values client side, then use Field.updateDisplayType to set the entry display type
e
I tried both INLINEEDITOR and EDITOR sublist types too. The sublist is populated on the UE based on the selected customer on the dropdown list.
b
share your inline editor version then
preferably with hard coded data
your client script looks like it should run normally on an inline editor
e
Thanks @battk I solved it using the DOM since no matter what I tried, Netsuite could not be coaxed with providing a "native solution"
j
Hi @Eric B I'm trying to do the same thing. Would you mind sharing your code snippet using DOM? Thanks!
e
Hi @Jars did you run into the same "limitations" that I described where no matter what approach you took using sublist.setCurrentSublistValue or record.setCurrentSublistValue that it looked like it did what it needed to do but it actually wouldn't update/refresh the sublist?
j
Yes! Same thing happened. I'm trying for both static and dynamic, and it's in inlineeditor sublist type. My current thought on this is, since I'm setting the value of scripted sublist field on beforeSubmit, it might really be a limitation since scripted sublist fields are not meant to store data... @Eric B
It worked for me now. It turned out that setSublistValue params for sublist and record obj are different. It solved my issue.
e
Ah ok so you're using an inlineeditor sublist type which won't work in my use case since it's a display only sublist that lives on the sales order form under the shipping tab.
j
I was able to make it work with LIST which is non-editable as well.