How do I trigger committing a sublist line only if it's been modified? I want to do the same thing that the 'Save' button does, but if I just blindly call commitLine() then if the line is blank it complains about validation since obviously none of the required fields are filled in.
b
battk
02/26/2019, 7:02 PM
More context required
battk
02/26/2019, 7:05 PM
Have you added some sort of button. Whats triggering your commitLine
w
Wolf
02/26/2019, 7:23 PM
Yes, this is triggered from a button
Wolf
02/26/2019, 7:24 PM
The idea is that it does some manipulation of the items on a sales order (adding markup items if necessary) but this doesn't work right if the button is clicked while there's a line item that hasn't been committed.
b
battk
02/26/2019, 7:34 PM
i dont suppose you can just be mean and cancel the current line and then do your logic
battk
02/26/2019, 7:40 PM
the alternative is a client script that keeps track of changed lines in the fieldsChanged and sublistChanged entry points
w
Wolf
02/26/2019, 8:19 PM
Yeah, I'd rather not just cancel the line item. I was hoping there was a call I'd overlooked like record.isLineChanged() but I guess not. Thanks for the advice.
Wolf
02/26/2019, 11:02 PM
After discussing it I ended up committing the line if it has an item filled in, otherwise cancelling. That way it takes care of the main case of filling in the whole thing but forgetting to hit add, without adding a big pile of logic around keeping track of if it's been modified.