I'm so very annoyed whenever I have to write logic...
# suitescript
e
I'm so very annoyed whenever I have to write logic like this in my business logic modules:
Copy code
if (data.newRecord.isDynamic) {
                data.newRecord.selectLine(subscribedField);
                data.newRecord.setCurrentSublistValue(util.extend(subscribedField, {value: true}));
                data.newRecord.commitLine(subscribedField);
            } else {
                data.newRecord.setSublistValue(util.extend(subscribedField, {value: true}));
            }
😪 1
😰 1
s
Yeah really not a fan of dynamic vs non-dynamic
e
It's unclear to me why
setSublistValue
doesn't determine and appropriately handle the different modes on its own. I suppose it would be mildly inefficient to select/commit on every field change, but man is it an annoying API to work with when you're writing agnostic logic
👍 1
</rant>
s
Yeah it almost makes you want to make a util to extend setSublistvalue and determine for yourself in there. But also select and setting multiple values before committing is a common need.