首页 > 技术文章 > 046_salesforce 中 Get URL

bandariFang 2017-12-04 17:23 原文

Suppose u have the whole URL as: < https://cs14.salesforce.com/apex/myVFpage?id=906F00000008w9wIAA >

    String baseURL = URL.getSalesforceBaseUrl().toExternalForm(); // it will return: < https://cs14.salesforce.com >
    String PageURL = ApexPages.currentPage().getUrl();   // it will return: < /apex/myVFpage?id=906F00000008w9wIAA >

So to get your whole exact URL you can write:

    String wholeURL = baseURL+PageURL; // it will return: < https://cs14.salesforce.com/apex/myVFpage?id=906F00000008w9wIAA >

推荐阅读