This repository was archived by the owner on Jan 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -126,11 +126,20 @@ if (forcetk.Client === undefined) {
126
126
this . apiVersion = ( typeof apiVersion === 'undefined' || apiVersion === null )
127
127
? 'v24.0' : apiVersion ;
128
128
if ( typeof instanceUrl === 'undefined' || instanceUrl == null ) {
129
- // location.hostname can be of the form 'abc.na1.visual.force.com' or
130
- // 'na1.salesforce.com'. Split on '.', and take the [1] or [0] element
131
- // as appropriate
129
+ // location.hostname can be of the form 'abc.na1.visual.force.com',
130
+ // 'na1.salesforce.com' or 'abc.my.salesforce.com' (custom domains).
131
+ // Split on '.', and take the [1] or [0] element as appropriate
132
132
var elements = location . hostname . split ( "." ) ;
133
- var instance = ( elements . length == 3 ) ? elements [ 0 ] : elements [ 1 ] ;
133
+
134
+ var instance = null ;
135
+ if ( elements . length == 4 && elements [ 1 ] === 'my' ) {
136
+ instance = elements [ 0 ] + '.' + elements [ 1 ] ;
137
+ } else if ( elements . length == 3 ) {
138
+ instance = elements [ 0 ] ;
139
+ } else {
140
+ instance = elements [ 1 ] ;
141
+ }
142
+
134
143
this . instanceUrl = "https://" + instance + ".salesforce.com" ;
135
144
} else {
136
145
this . instanceUrl = instanceUrl ;
You can’t perform that action at this time.
0 commit comments