Whatever, your instance might be:
- cs2
- emea
- na5
- na4
One way of tackling this issue that you might find it useful:
You can always use the following javascript code to get the URL:
Code: // getDomain() is called to obtain the domain portion of web appfunction getDomain() { var url = window.location.toString(); var domain = url.match( /:\/\/(www\.)—([^\/]+)/ ); domain = domain[2]?domain[2]:''; return domain; } |
Good solution Sam!
ReplyDeleteI've taken a slightly different approach to determining the current pod URL that is perhaps a bit more pedestrian. I use the following formula in custom links/custom web tabs, S-controls, etc.:
MID( $Api.Enterprise_Server_URL_130, 9, 18)
Can you show me an example of using this with a custom link?
DeleteGreat post.
ReplyDeleteHelps me a lot.
But i want instance in apex class.
Can we do that?
It's best to use relative path in Apex, as your code may be deployed in to various production environments.
ReplyDeleteHi Sam,
ReplyDeleteCan you please send me a sample example of this. I am a newbie to Salesforce. How to implement this in VF pages?
hey.. i hv written a method to capture the domain url.. i wantu call that method in a trigger..I have called it like this : classname.methodname(parameter); .trigger is throwing an error which says ... 'parameter' doesn exist.. can smbdy help ...
ReplyDelete