You need to sign in to do that
Don't have an account?
Lakshman
Help me choose best!
Hi All,
I want to declare some constants which will be used by my Apex class. I find two approches to it.
1) Custom Settings
2) Global class and declare static varible in the that class. Then access them in my desired class.
Let me know which one would be better.
Thank you!
Regards,
Lakshman
I'd use option 1 if you want administrators to be able to change the constant (for example, if they contained record type names that may change going forward).
I'd use option 2 if you are simply trying to avoid hardcoding magic strings/numbers into your classes.
All Answers
I'd use option 1 if you want administrators to be able to change the constant (for example, if they contained record type names that may change going forward).
I'd use option 2 if you are simply trying to avoid hardcoding magic strings/numbers into your classes.
I am savind values which would be used while sending email like To address, Email template, such kind of things.
Administrators will edit this value. I think option 1 would be better. Let me know your thoughts.
Indeed option 1 is best between the two, but you can also consider creating custom labels if you are talking about strings.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Thats also a good suggestion Ankit. But I think in future there can be name value pair. So I would go for Custom Settings.
Regards,
Lakshman
If there is a name value pair then you should go for custom settings. I have implemented same using custom setting in many of my projects.
Thanks
Ankit Arora
Blog | Facebook | Blog Page