• Sasank Vars
  • NEWBIE
  • 4 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

We were excited to read about this new class and method in the Summer 11 releas.  However, it doesn't look like this method behaves as it should. 

 

Documentation states:


Returns the URL of the Salesforce instance.
For example, https://na1.salesforce.com.

 

If I execute the following line from the system log....


String baseUrl = System.URL.getSalesforceBaseUrl().toExternalForm();

System.debug('baseUrl =' + baseUrl);

 

This produces this output...

baseUrl = https://na8.salesforce.com/apexdebug/SystemLog.apexp

 

which is incorrect because it includes 'apexdebug/SystemLog.apexp'.

 

Even worse, if I run the same code from a controller tied to a visual force page, I get...

 

baseUrl=https://c.na8.visual.force.com/services/Soap/class/CreditPersonsWS

Is this a bug or am I misunderstanding what the purpose of this method is?

 

Thanks