Team, I have a question about transaction processi...
# suitescript
a
Team, I have a question about transaction processing with SuiteScript. I basically need insert/update two custom records, but I would like to rollback the transaction if an error ocurres somewhere. Is there a way to accomplish this with SuiteScript?
b
you need a better definition of somewhere
a
Okay, let me explain better. My script is an integration that will create an invoice record and also create another custom record containing additional details about the invoice. The script will save the invoice record and get the invoice id, then create the related records using that invoice id. But if there is an error creating the detail records related to the invoice, I would like to rollback the entire transaction, the detail records already created and the invoice record already created. Basically I am looking for transaction processing, where at the end if there are no errors I can commit or rollback
b
what errors do you expect on the detais?
a
well, let’s say the data provided is not valid, like the customer number is not valid
a
or the account number
b
go through the section on 2.3.4 Using Parent-Child Relationships to Perform Mass Create/Update
although honestly i say the entire thing if you want to know what netsuite's best practices are
a
okay, I read that section. So, there seems to be some built in transaction processing for parent-child records, which is good
but I am trying to do this with multiple records, and they cannot be all parent-child
I need a bit more control
b
nope, be clever with parent/child
or give up on transactional rollback
a
okay, thanks. I will do some tests