You need to sign in to do that
Don't have an account?
Dippan Patel
Get Salesforce Instance from APEX
Hi All,
I want Salesforce instance name to add a remote site.
Below is my code:
I get proper server names such as CS10, CS94 in case of Developer orgs and production.
However, in case of some sandboxes, I get server as visualforce.
Due to this the variable direct turns out to be https://visualforce-api.salesforce.com instead of https://yourdomain-api.salesforce.com
Not able to understand why?
I want Salesforce instance name to add a remote site.
Below is my code:
String host = URL.getSalesforceBaseUrl().getHost(); String server = host.split('\\.')[1]; String direct = 'https://' + server + '-api.salesforce.com';
I get proper server names such as CS10, CS94 in case of Developer orgs and production.
However, in case of some sandboxes, I get server as visualforce.
Due to this the variable direct turns out to be https://visualforce-api.salesforce.com instead of https://yourdomain-api.salesforce.com
Not able to understand why?
use this code
All Answers
use this code