You need to sign in to do that
Don't have an account?

getSalesforceBaseUrl returns http: not https:
Hello. When I execute Url. getSalesforceBaseUrl().toExternalForm() in the system console, the returned URL uses https:// However, when I execute this in the finish() method of Batch Apex, it returns http:// Is this a bug? I need https:// returned in the Batch Apex. Thanks David | |
Hi David,
I had a similar problem. I was using the URL.getSalesforceBaseUrl().toExternalForm() to construct a link inside an email template. When the templates were sent, the 'https://' portion of the link morphed into 'http://', which did not work correctly.
I made the following utility method in Apex to ensure I could retrieve the base url beginning with 'https://'. Its a bit crude, and this may well be a bug, but for now it guarantees that I get the right link.
Regards,
Christopher Alun Lewis
All Answers
Hi David,
I had a similar problem. I was using the URL.getSalesforceBaseUrl().toExternalForm() to construct a link inside an email template. When the templates were sent, the 'https://' portion of the link morphed into 'http://', which did not work correctly.
I made the following utility method in Apex to ensure I could retrieve the base url beginning with 'https://'. Its a bit crude, and this may well be a bug, but for now it guarantees that I get the right link.
Regards,
Christopher Alun Lewis