Different values from URL.getSalesforceBaseUrl().toExternalForm()
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
I have a managed app that uses URL.getSalesforceBaseUrl().toExternalForm() to create a Remote site for ToolingApi. This works great in all environments (Production, Dev/scratch org), however, it's pretty unreliable in Sandboxes. Sometimes it returns the proper URL sometimes it doesn't.
For example: While running the app in a sandbox, this line of code
URL.getSalesforceBaseUrl().toExternalForm()
returns https://examplesite--testing.my.salesforce.com
However, using that same method inside Execute anonymous returns
https://exmplesite--testing.cs61.my.salesforce.com which is the correct url needed for the toolingApi.
Anyone have any insight on what could be happening?
apex lightning sandbox debugging
New contributor
add a comment |Â
up vote
4
down vote
favorite
I have a managed app that uses URL.getSalesforceBaseUrl().toExternalForm() to create a Remote site for ToolingApi. This works great in all environments (Production, Dev/scratch org), however, it's pretty unreliable in Sandboxes. Sometimes it returns the proper URL sometimes it doesn't.
For example: While running the app in a sandbox, this line of code
URL.getSalesforceBaseUrl().toExternalForm()
returns https://examplesite--testing.my.salesforce.com
However, using that same method inside Execute anonymous returns
https://exmplesite--testing.cs61.my.salesforce.com which is the correct url needed for the toolingApi.
Anyone have any insight on what could be happening?
apex lightning sandbox debugging
New contributor
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I have a managed app that uses URL.getSalesforceBaseUrl().toExternalForm() to create a Remote site for ToolingApi. This works great in all environments (Production, Dev/scratch org), however, it's pretty unreliable in Sandboxes. Sometimes it returns the proper URL sometimes it doesn't.
For example: While running the app in a sandbox, this line of code
URL.getSalesforceBaseUrl().toExternalForm()
returns https://examplesite--testing.my.salesforce.com
However, using that same method inside Execute anonymous returns
https://exmplesite--testing.cs61.my.salesforce.com which is the correct url needed for the toolingApi.
Anyone have any insight on what could be happening?
apex lightning sandbox debugging
New contributor
I have a managed app that uses URL.getSalesforceBaseUrl().toExternalForm() to create a Remote site for ToolingApi. This works great in all environments (Production, Dev/scratch org), however, it's pretty unreliable in Sandboxes. Sometimes it returns the proper URL sometimes it doesn't.
For example: While running the app in a sandbox, this line of code
URL.getSalesforceBaseUrl().toExternalForm()
returns https://examplesite--testing.my.salesforce.com
However, using that same method inside Execute anonymous returns
https://exmplesite--testing.cs61.my.salesforce.com which is the correct url needed for the toolingApi.
Anyone have any insight on what could be happening?
apex lightning sandbox debugging
apex lightning sandbox debugging
New contributor
New contributor
New contributor
asked 4 hours ago
user60315
211
211
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
In Winter 19, we will have a new method, System.Url.getOrgDomainUrl()
, which will always return the correct URL.
Use the new
System.Url.getOrgDomainUrl()
method to interact with Salesforce REST and SOAP APIs in Apex code. Get
endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more. Use the updated
System.UserInfo.getSessionId()
method to retrieve session IDs, even when your code runs asynchronously.
The System.URL.getSalesforceBaseUrl()
method is intended to return the host for the current context (e.g. Lightning, Visualforce, Classic UI, Communities). This new method will always return the correct My Domain URL that should be used, and should work correctly with all Sandboxes.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
In Winter 19, we will have a new method, System.Url.getOrgDomainUrl()
, which will always return the correct URL.
Use the new
System.Url.getOrgDomainUrl()
method to interact with Salesforce REST and SOAP APIs in Apex code. Get
endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more. Use the updated
System.UserInfo.getSessionId()
method to retrieve session IDs, even when your code runs asynchronously.
The System.URL.getSalesforceBaseUrl()
method is intended to return the host for the current context (e.g. Lightning, Visualforce, Classic UI, Communities). This new method will always return the correct My Domain URL that should be used, and should work correctly with all Sandboxes.
add a comment |Â
up vote
2
down vote
In Winter 19, we will have a new method, System.Url.getOrgDomainUrl()
, which will always return the correct URL.
Use the new
System.Url.getOrgDomainUrl()
method to interact with Salesforce REST and SOAP APIs in Apex code. Get
endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more. Use the updated
System.UserInfo.getSessionId()
method to retrieve session IDs, even when your code runs asynchronously.
The System.URL.getSalesforceBaseUrl()
method is intended to return the host for the current context (e.g. Lightning, Visualforce, Classic UI, Communities). This new method will always return the correct My Domain URL that should be used, and should work correctly with all Sandboxes.
add a comment |Â
up vote
2
down vote
up vote
2
down vote
In Winter 19, we will have a new method, System.Url.getOrgDomainUrl()
, which will always return the correct URL.
Use the new
System.Url.getOrgDomainUrl()
method to interact with Salesforce REST and SOAP APIs in Apex code. Get
endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more. Use the updated
System.UserInfo.getSessionId()
method to retrieve session IDs, even when your code runs asynchronously.
The System.URL.getSalesforceBaseUrl()
method is intended to return the host for the current context (e.g. Lightning, Visualforce, Classic UI, Communities). This new method will always return the correct My Domain URL that should be used, and should work correctly with all Sandboxes.
In Winter 19, we will have a new method, System.Url.getOrgDomainUrl()
, which will always return the correct URL.
Use the new
System.Url.getOrgDomainUrl()
method to interact with Salesforce REST and SOAP APIs in Apex code. Get
endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more. Use the updated
System.UserInfo.getSessionId()
method to retrieve session IDs, even when your code runs asynchronously.
The System.URL.getSalesforceBaseUrl()
method is intended to return the host for the current context (e.g. Lightning, Visualforce, Classic UI, Communities). This new method will always return the correct My Domain URL that should be used, and should work correctly with all Sandboxes.
answered 2 hours ago
sfdcfox
227k10175389
227k10175389
add a comment |Â
add a comment |Â
user60315 is a new contributor. Be nice, and check out our Code of Conduct.
user60315 is a new contributor. Be nice, and check out our Code of Conduct.
user60315 is a new contributor. Be nice, and check out our Code of Conduct.
user60315 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232847%2fdifferent-values-from-url-getsalesforcebaseurl-toexternalform%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password