```load record set value set value set value save ...
# suitescript
a
Copy code
load record
set value
set value
set value
save record
can we save this record if the second set value wasn't correct and thrown an error?
c
Not optimal, but... try/catch on each setValue would do it...
a
it didn't work for me
j
How do you know the second value wasn't correct?
c
Interesting... I've done it that way a lot, when I really needed to keep going even on failure.
a
let's say we want to edit and save 4 records and for sure we now the second set value data for one of them is not valid
@Charles.Bastian how shall I write it
j
Seems like most of this can be handled with conditionals.
vaildValue ? rec.setValue(validValue) : '';
👍 1
c
@Ali Here is an example of the setter function that I use, when I need to do something like this. I modified it to remove anything proprietary, but it should still work fine as an example.
a
many thanks
👍 1
s
.setValue()
doesnt error until you save, so that function above will not hit the catch aprt
c
Odd. It's been working for me for a while. And catching errors, on the set... ? Not very surprising though, if it should not. lol...