• Grant Liu - 10 years ago

     Would be really helpful. Headers works only if you have a request context - which you do not in triggers.
    • Flag
  • Evgeny Soloho - 10 years ago

     Hi, to identify SF server name from Visualforce page  I use following formula: MID($Api.Enterprise_Server_URL_25, 11, 3)

    This returns instances name an you can workaround it.

     

    • Flag
  • 麻紀 阪田 - 10 years ago

    need this for email links.
    • Flag
  • Gireesh Sonnad - 10 years ago

     definitely needed!
    • Flag
  • Prageeth Jayasinghe - 10 years ago

    Really helpfull.
    • Flag
  • Jason Favors - 10 years ago

    Definitely need for Visual Force email templates.  Seems odd that they would have this functionality for standard HTML templates with the {!Object.Link} merge field, but not have something for the Visual Force templates.
    • Flag
  • Jon Sheppard - 10 years ago

     Would be nice!
    • Flag
  • System User - 10 years ago

    Simple and def. required
    • Flag
  • Deepa Shyamala - 10 years ago

    This is a really helpful one.
    • Flag
  • suresh kumar - 10 years ago

    waiting to get soon
    • Flag
  • Thomas Hoban - 10 years ago

    I'm shocked that there isn't a good way to do this.  I have a use case where I need to identify the server in a batch program.  The batch sends emails using Visual Force Email templates that contain references to some images.  We need to provide the full url for the image.
    • Flag
  • M. J. Kahn - 10 years ago

    A Chatter FeedPost's LinkURL field requires a full URL. If you're creating a FeedPost outside the context of a VF page (so you don't have access to a PageReference), there's no good way to get the current org's Salesforce instance, so you can't construct a full URL, at least not without resorting to some ugly custom workaround.
    • Flag
  • Arvind Kaul - 10 years ago

    A typical API Server URL in a dev sandbox appears as "https://c.cs3.visual.force.com/services/Soap/c/18.0/00DQ0000000AgYM", where the record ID is ORG ID.

    I am generating this API Server URL in my APEX class using "ApexPages.currentPage().getHeaders().get('Host')", which gives the instance server url "c.cs3.visual.force.com". Then I use two other constants to form the actual API Server URL, which is "https://" and "services/Soap/c/18.0".

    API Server URL= 'https://'+ 'ApexPages.currentPage().getHeaders().get('Host')' +'services/Soap/c/18.0/'+ORG_ID

    I believe there should be a robust way to retrieve API Server Url in APEX class or trigger then going via such workarounds, and expect Salesforce to come up with some solution in coming releases.
    • Flag
  • Admin Rights Engine - 11 years ago

    This Apex works (to get to the detail page of a custom Quote object): 'https://' + ApexPages.currentPage().getHeaders().get('Host') + '/' + quote.id
    • Flag
  • Aki Teronen - 11 years ago

    really needed. I.e. for having integrations that have own QA with own parameters with your sandbox. Today suggested solution is to have custom field with api url and parse from there. Own method would be more robust.
    • Flag