I'm having issues coming up with the instance name (i.e. na1) needed for generating a URL to a VF page with "My Domains" enabled.
The changes for My Domains are described well here: https://na15.salesforce.com/help/doc/en/domain_name_app_url_changes.htm
I am trying to construct: https://$subdomain--$yournamespace.na1.visual.force.com/apex/ within an apex batch job.
In the past I have used:
String sfUrl=URL.getSalesforceBaseUrl().getHost() to pull out the instance name (na1, etc).
However with My Domains enabled
String sfUrl=URL.getSalesforceBaseUrl().getHost() outputs
customdomaintest-dev-ed.my.salesforce.com. Notice that the instance name is not present. So, I'm unsure of how to get the instance name which I need to construct the Visualforce page url.
Does anyone have any tricks up their sleeve? The only option I know of right now is having a org wide custom setting that can be manipulated to impact the url.