Specific Server URL in Javascript

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Hello!

I'm using javascript to populate a url and I need to replicate {!$Api.Partner_Server_URL_160} using a snippet.

I've been using sforce.connection.partnerServerUrl in the snippet but this doesn't specify the version (16).

Any thoughts? Cheers!

Louis
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
(Edited)
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
And here's my snippet:

var params = arguments[0],
	$ = skuid.$;
	
	
// Get the Ids of the selected items as an Array


var idsArray = skuid.$.map(arguments[0].list.getSelectedItems(),function(item){ 

   return item.row.Id; 

});


// STEP 1: CHANGE THE NEXT LINE TO THE TYPE OF RECORDS YOU'RE ACCESSING ON THE VIEW
// var idArray = {!GETRECORDIDS( $ObjectType.Lead )};

// STEP 2: CHANGE THE NEXT LINE TO THE API NAME OF THE FIELD THAT CONTAINS THE POINTMERGE URL


var urlFieldName="Conga_Batch_Profit__c";


// DO NOT MODIFY ANYTHING BELOW THIS POINT ********************

// YOU MAY PASS UP TO 50 IDS

var CongaURL = "https://conductor.congamerge.com" +
"?MOID=" + idsArray +
"&SessionId=" + skuid.utils.userInfo.sessionId +
"&ServerUrl=" + sforce.connection.partnerServerUrl +
"&UrlFieldName=" + urlFieldName;

window.open( CongaURL, "Conga", "width=700,height=450,menubar=0" );
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Take a look here:  http://help.skuidify.com/m/11720/l/187263-global-merge-variables-functions

Key graph:  
$Api.Partner_Server_Urls: A map containing all Partner Server Urls for past API versions of Salesforce starting with API v3, keyed by the integer version of the Api. Example: using $Api.Partner_Server_Urls.29 would return the same thing as $Api.Partner_Server_Url above, whereas $Api.Partner_Server_Urls.3 would return something likehttps://skuid.na11.visual.force.com/services/Soap/u/3.0/00DG0000000XHQa"  

Available in JavaScript via sforce.connection.partnerServerUrls.

One thing that tripped me up recently was that your call needs to be version 16,  not to version 160. 
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
sforce.connection.partnerServerUrls.16

Louis as you've noted, this URL is a Visualforce server URL, which is different from the .salesforce.com Domain partner server URL. I think that this is sometimes a problem, sometimes not. I seem to recall that if Conga needs to access Reports, then it needs the .salesforce.com URL and a .salesforce.com Session Id, but if Conga just uses SOQL to perform its queries, then it can use the Visualforce Server URL's and Session Ids.
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
Hi Rob, Zach. Thanks for that. I'm having a few issues with the conga conductor tool and just wanted to remove Skuid as a possible source for those issues - which I've now done. It looks like the version and the url don't have a bearing. I'm now working with Conga as we think the issue lies with them.

Cheers!
Photo of Peter Herzog

Peter Herzog

  • 1,664 Points 1k badge 2x thumb
Louis, were you able to resolve this with Conga?  Having similar issues over here.
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
Hi Peter,

Yes, I managed to rule out Skuid as causing the issue and then shunted it over to Conga by discussing this with them directly. I updated to the latest version of Conga Conductor (it's in beta) and haven't had any issues since. Might be worth punting this over to them to take a look?