I want to create a global numeric sequence that works for both the Lead and Account object, because we will integrate Salesforce with an ERP that works with leads and accounts in the same object, therefore, they cannot have separate sequences. I'm thinking of creating it via custom settings and keeping it updated and integrated via Apex. What considerations should I have when doing that? Could it lead to many data problems?

Thank you very much in advance.

1 Answer 1


You can use custom settings or custom metadata, I do recommend custom settings because for custom metadata you need to use the Operations Class methods to update the values.

Custom Settings

The limits from custom settings are the same as custom objects. Since they are a special type of Custom Object, it shouldn't lead to any problem if follows the SF best practices.

Custom settings are a type of custom object. Each custom setting counts against the total number of custom objects available for your organization.


Edit: https://help.salesforce.com/s/articleView?language=en_US&id=sf.cs_limits.htm&type=5

Custom Metadata:


For custom metadata you should consider how many updates you'll do on the value:

For deployments, because of Metadata.Operations.enqueueDeployment() uses asynchronous Apex, queued deployment jobs and deployment callbacks are counted as asynchronous jobs in the current org. Queued deployment jobs and callbacks are subject to governor limits. See Lightning Platform Apex Limits.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .