You need to sign in to do that
Don't have an account?
Moha
Getting the URL for the current organization instance at runtime
Hello I need to retrieve the Url of the current Organisation at runtime i used this url but it doesn't retrieve the right url :
https://'+ApexPages.currentPage().getHeaders().get('Host')
thanks for the help
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm
thanks for the reply, i've already used this but it doesn't solve my problem, i need in Portal site to call a document Text through apex Class
so when i use the :
URL.getSalesforceBaseUrl().toExternalForm() + '/servlet/servlet.FileDownload?file='+lstDocument[0].Id;
return strDocUrl;
it return SiteInstance/servlet/the rightfile but it's not shown on the Site
but if i hardcode the url as example : https://c.eu10.content.force.com/servlet/... it shows the Document on the Site
so i don't know how to get the Second Url Dynamically
thanks for the help
like
String fileURL = URL.getFileFieldURL( lstDocument[0].Id ,'AttachmentBody');
return fileURL;
i get this Error, i searched in the book and i used the correct method but i get this error : Method does not exist or incorrect signature: URL.getFileFieldURL(Id, String) at line 33 column 27
practicaldetail = 'PracticalDetail';
List<Document> lstDocument = [Select Id,Name,LastModifiedById from Document where Name = :practicaldetail limit 1];
String fileURL = URL.getFileFieldURL( lstDocument[0].Id ,'PracticalDetail');
return fileURL;
List<Document> lstDocument = [Select Id,Name,body,LastModifiedById from Document where Name = :practicaldetail limit 1];
String fileURL = URL.getFileFieldURL( lstDocument[0].Id ,'body');