1

We used to use a ordinary number field to dynamically generate record names in the trigger (because the name is composed of several parts). But now we are considering more about the thread safety. Say suppose two users try to create a record at the same time, the trigger might possibly populate a same number. So we are thinking of switching to auto-number though it is not strictly consecutive.

However, as we are working for a managed package. Auto-number field cannot be added into a managed package object. Is there a proper way to generate an auto-number like field when considering thread safety?

1

One solution is to create an additional object just to maintain the sequence. Use the name(autonumber) field of the new record and assign it to your number field of the object you are working on. This is not an ideal solution and would utilize one custom object but sometimes it can help.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.