function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David OvellaDavid Ovella 

How to create a trigger that allow a custom number field go in only consecutive order?

Hello, I want to know if it's possible to create a trigger to let a number field be created only in a consecutive order
Example: (001 to 100)
PreImpreso 001
PreImpreso 002
If I try to enter 004 and 003 was not entered yet, I get the error "number isn't going in consecutive order"
James WooleyJames Wooley
This sounds like a business case for an Auto-Number field, rather than a trigger to me!

See https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_field_attributes.htm&language=en#Auto-NumberFormattingExamples (https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_field_attributes.htm&language=en#Auto-NumberFormattingExamples) for some examples.