• Schmitt Hickerson
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
We would like to avoid to hardcode value in an apex class and use "environment variable". Is the use of custom settings the right way to do that ? 

Today I created a custom settings containing 2 fields, an url and a authorization token. The values are differents from one sandbox to another, so I create one data set for each of my sandbox (dev-int-uat-prod). Now my problem is to know in wich sandbox am I ? To retrieve the right values from my custom setting and of course I don't want to hardcode it. I used UserInfo.getUserName().substringAfterLast('@').substringAfterLast('.') to retrieve the sandbox name but for production this code doesn't work, so can anyone help me on the best way to do that ?

Thanks in advance for your answers and your help.