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?


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

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.