I have an invoice item and payment object. I want to add payment to the invoice, as long as the amount on the invoice is zero Does not exist Outstanding balance on invoices must be less than zero.
I can create an updated trigger against checking the payment amount applied to the invoice, and throwing an AddError to prevent it from collecting data but, before I update or after the update Should use?
Can the situation of a race if two people pay 200 $ at the same time with an amount of $ 200 on an invoice, the outstanding amount on the invoice can be $ 200 for both triggers , And therefore both payments apply to the invoice, it will bring the total in the negative.
Update on Using it will ensure that the transaction will be completed before updating it to another user. the keyword in the docs.
No comments:
Post a Comment