To create a Visualforce command button to call Conga Composer, you’ll need to access the current Session ID and Partner Server URL endpoint. We’ve seen at least two techniques to accomplish this.

Due to their complicated nature, the integration of Conga with JavaScript, Visualforce, and Apex (or other programming languages) is not supported. JavaScript buttons will not work in Salesforce Lightning. We recommend you choose a different implementation technique or engage Conga Services to build a custom solution.

To create a Visualforce command button to call Conga Composer, you’ll need to access the current Session ID and Partner Server URL endpoint. We’ve seen at least two techniques to accomplish this.

Technique #1

Alternatively, if you absolutely must access Salesforce Reports, you would need a SessionId and ServerUrl from a "front-end" server, and then pass those values into the Visualforce page. This is easy to do if you happen to be calling your Visualforce page from a button since you can pass the SessionId and ServerUrl as querystring parameters, like this:

/apex/MyPage
?SessionId={!$Api.Session_ID}
&ServerUrl={!$Api.Partner_Server_URL_130}

Technique #2

Another technique to create a simple Conga Composer button on a Visualforce page would be as follows. We particularly like this technique because you can create a normal Conga Composer button on an object, and simply “point” to the standard button on the Visualforce page.

<apex:commandButton value="Create PDF Quote"
action="{!URLFOR($Action.Opportunity.View,Opportunity.Id)}"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Opportunity.Do_The_Conga,Opportunity.Id)}', '','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

Do_The_Conga is referring to the API name of the standard button which you are trying to click via the Visualforce button.