I want a select field on lines in a sublist of a c...
# suitescript
j
I want a select field on lines in a sublist of a custom record. I want each instance of the select field to be different though. Each line has an item, and this select field is for the vendor - we only want to show vendors that are applicable for the item selected on the line. Ive added a field in the UE, and am using lineInit/getCurrentSublistField/insertSelectOption to almost get this to work. The only problem is that since this changes the options for all instances of the fields, not just the field on the line, then if an items vendor isn't available for another item, then the field will show as blank. ie, if you selected a vendor, selected a different line, and that new line didn't have that vendor available, then the vendor field on the original line would change to blank when you selected the new line Maybe im overthinking this, how can I accomplish this?
r
Look at the options on the Transaction Line Field definition. You should just be able to use Sourcing and Filtering.
actually, i think you'll run into the same issue. sources the same for every line
j
Yeah I originally tried that, but I couldn't figure out how to have it filter based off of that specific line's item. (We have the main parent custom record, and a line custom record. The item and vendor fields are on the line record)
r
I know in SS1.0 there were things you could do on a per-line basis that are not possible in SS.2.x. SS2 tends to treat all fields in a column uniformly, which is good IMO. Maybe try that.
j
All im seeing is nlapiInsertLineItemOption, which seems to work the same way as ss2, it affects all instances of the field, and doesn't even let me pass it a line number. Is there a different function i should be using?
r
no that sounds right. probably not a feasible requirement
a
how about a second field on you're custom line record? that's inline, and has all options available for vendor, its just a list/record vendor field... nothing clever. when a line is committed and a value is set in your existing line level vendor field, you copy the the value of the vendor from that field to your basic field of the same type. then your value is stored probably need to add some show/hide fields logic to make it pretty in UI i guess but I think the gist of that should work for your use-case
so your options only really matter on the current active line, because that field with the options you're manipulating doesn't store anything once a line is committed its stored in the other field and so you don't care what options are now missing for lines which are already committed.
j
Yeah thats what I was thinking, would just be a little confusing for new users as to why there are two vendor columns, and the one they can edit behaves a bit weirdly.
👍 1
a
right if you wanna get fancy with it you can use client side (non netsuite) stuff to show/hide the fields so from the user perspective it looks like only one field at all times?... but I'm not sure its worth it... this can be addressed by documentation/training
j
Yeah thats fair. My other idea is an inline html field, and do something completely custom, but that would also be a pain