Is it possible to add custom global values in Salesforce so that we can use that global value in any apex class or controller?

And this values will be Ids of custom objects, so they will be different for sandbox & production environment.

So if we can add global value, then how we can do so?

And how we can set values for them if we move code to production?

1 Answer 1


You can use Custom Settings to add global values and those are in cache. You dont need to separate SOQL to retrieve those values.

You can refer them in apex or validation rules.

Need to import them as data (using data loader or workbench).

Refer Custom settings

You must log in to answer this question.

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