I believe i want to use hierarchical custom settings so that in salesforce my lightning component makes a webservice external call based on the environment I'm in
- sandbox (dev) calls webservice-dev url
- sandbox (test) calls webservice-test url
- production calls webservice-prod url
I am going to have my apex class that gets the http request make a call to my custom settings entry
What I've tried in my apex code
talend_esb_url__c.getInstance('dev').URL__c;
this doesnt work because I need my lightning component to make this decision dynamically, a hard coded dev will simply migrate up/ become issue on a prod redeploy
talend_esb_url__c config = talend_esb_url__c.getOrgDefaults().URL__c;
this doesnt work as the org defaults are always shown (not by environment)
tried selecting organization to determine if im in a sandbox, but this doesnt work as we have more than 1 sandboxes
select Id, IsSandbox from Organization limit 1
I want to create a custom setting for a webservice callout url that I can change dynamically based on which salesforce environment I am in
EDIT:
this is actually a duplicate of How to get the current sandbox-name programmatically (dynamically) via APEX? basically the same situation
I'd close the question if i could