Hello, I have a saverecord script that is preventi...
# suitescript
p
Hello, I have a saverecord script that is preventing a record from being saved? the script is not throwing an error. what would be a reason why it would possibly not work
b
what does the code look like
p
the script should be doing a return because it meets the criteria. here is the code: function saveRecord(context) { var errortothrow = 0; var linenum = 0; var rec = context.currentRecord; var isfromamortization = rec.getValue({fieldId: 'isfromamortization'}); log.debug({details:"isfromamortization= " + isfromamortization}); var isfromexpensealloc = rec.getValue({fieldId: 'isfromexpensealloc'}); var isfromrevrec = rec.getValue({fieldId: 'isfromrevrec'}); if (isfromamortization === 'T' || isfromexpensealloc === 'T' || isfromrevrec === 'T') { //3 return; } //1-A
so in this case the value for isfromamortization is true
b
The return value of a saveRecord has meaning
returning nothing is the same as returning false
p
got it. so I need to set it to return true to stop the script
I don't want any further validation if those flags are true
b
read the docs for save record to know when you should return true or false
p
thanks