How to validate entries by recording record types?
I created a button in a Suitelet form which call a function to save a generated number adding one to the last generated in a custom record type, the button works and it save the new number as it is expected, the problem is when more than one user click the button at the same time to generate a new number, it supposed to give a different number for each one, but it return the same number. How do I validate to give a new number even if the button is clicked by two or more users?
here is part of my code:
Client (function for the button):
Thanks in advance.
I think you’d have to implement some sort of record locking so that you first obtain a lock on the record before updating the ID.
Other instances of the same script should retry until they obtain a lock.
As such, use some ID known only to the current instance of the script to perform the lock.
Hope that makes sense and happy to answer any further questions.