Is there an easy way to get the SF instance (i.e., "NA14")?

I think because of our custom domain and the fact that we are using a portal, our custom Skuid button for a third-party product (DrawlLoop) needs to “get” the instance of Salesforce we are on and pass it via the URL. Is there an easy way to do that? I’m hoping it’s in the Skuid API somewhere so that I don’t have to either a) hardcode it, or b) parse the URL.

Have you tried generating the button using Drawloop’s button generator tool, and then exposing it like via Skuid from the dropdown like you would for any other page button?

The short answer is no, there is no reliable, easy way to get the SF instance, particularly in an org with My Domain enabled, without parsing the URL of a Visualforce Page.

However, in Salesforce Summer 14 they are exposing an “InstanceName” field on the Organization object, so you could create a Model on the Organization object to pull in the current Organization and grab the Instance Name off of that, then in your Redirect URL’s for launching an app like Drawloop  you could do:


But this won’t be available until July. In the meantime, hardcoding the Instance Name is probably the easiest approach, or else you’re going to have to parse the URL of the current Visualforce Page you’re on.