Next challenge, anyway to add select option to a s...
# suitescript
n
Next challenge, anyway to add select option to a sublist column? I have a suitelet that has an item column. Click a button to search for an item which takes you to a second suitelet in a new tab. Enter values, if the item is not found the item is created, and in either case (created / found via search) the item id is returned and set on the line. I'm fine when the item already exists but for newly created items it's causing me a headache... according to help: Record.getCurrentSublistField(options) should give me the field but using that were Record is currentRecord.get() it seems it's not supported.
s
If your item list is set to source from
item
, then no you cannot add select options. To retrieve the new list of items you would need to reload and let it resource that list
n
No my list column is not setup that way. I run a search and populate using addSelectOptions. However I'm calling out to a second SuiteLet and on window.close capturing the return value for the item which could be a new item not in the list column. So I'm setting the item column value just fine but it appears "textless" if the item is a new item not already in the list. The problem of course is that to the user the process appears to have failed and never set the column. I know it's correctly seeing and setting the value, that's fine but I seem unable to add the select option. Arguably the currentRecord is not Record and currentRecord does not support getCurrentSublistField so I think I'm sunk.
s
I've never tried dynamically adding select options to a sublist field after the page is already rendered so I can't be sure if its supported or not. 🤷‍♂️
n
Thank you for replying (hopefully I don't come across unappreciative). I've been fighting with this for about 90 mins and figured I've exhausted all options and know there are cleverer people than me here Oh well, I finish for the week in 30 mins, starting to feel like a "Monday" problem😁
b
it has failed me many times because of its line parameter
n
Thanks for the reply, I did try that to no avail. The answer, actually, was to set the source to inventory_item rather than source teh list manually via a search, which feels the opposite to what I'd imagine doing. Quite bizarre but one to make a mental note of and potentially a future source of frustration if you want to limit the list options to a subset of records.