To create a Visualforce command button to call Conga Composer, you’ll need to access the current Session Id and Partner Server URL endpoint.
Example Visualforce button that defaults the template, output as PDF, does not automatically log after merging, attach file to "Notes and Attachments" related list without task record, and creates a unique name for the merged document:
<apex:commandButton id="ButtonPDF" reRender="none" value="Generate PDF" onclick="window.open('https://www.appextremes.com/apps/Conga/Composer.aspx?SessionId={!$Api.Session_ID}&ServerUrl={!$Api.Partner_Server_URL_210}&LG3=2&LG4=0&DefaultPDF=1&Id={!CustomObject__c.Id}&TemplateId=a17n00000008aVS&FP0=1&OFN={!CustomObject__c.Name}+--+{!CustomObject__c.CustomField__c}+--+{!CustomObject__c.CustomField__c})','_blank','toolbar=yes, scrollbars=yes, resizable=yes, top=50, left=300, width=700, height=525' );" />
LG3=[0, 1 or 2]
Sets the file attachment options.
LG4=[0 or 1]
DefaultPDF=[0 or 1]
Sets the default output type to Adobe Acrobat.
Id=[id]
Sets the master object from which all fields are retrieved.
Note: A Conga Composer URL must contain one (and only one) instance of this parameter.
For example, the Id would be "&Id={!CustomObject__c.Id}".
FP0=[0, 1 or 2]
Locks the output file format.
This is the unique record Id generated by Salesforce.com for the Conga Template. This parameter will select the template by default when included in the URL.
Note: You will need to update the TemplateId value if you create a new Conga Template record and/or if you use Change Sets between Orgs since the unique Id will change.
OFN=[text]
Sets the Output File Name, overriding the default output file name.
Note: This parameter is limited to 245 characters. You may use static text or merge field names for the values to place in the filename. Use a plus sign (+) to represent literal spaces. Do not include symbols unsupported in filesnames, “\”, “/”, “>”, “<”, etc.
Example:
...&OFN={!Account.Name}+-+Quote
If the Account name is “ABC Corp.”, the resulting file name would be "ABC Corp. – Quote.doc".
Example Visualforce button that defaults the template, output as PDF, does not automatically log after merging, attach file to "Notes and Attachments" related list without task record, and creates a unique name for the merged document:
<apex:commandButton id="ButtonPDF" reRender="none" value="Generate PDF" onclick="window.open('https://www.appextremes.com/apps/Conga/Composer.aspx?SessionId={!$Api.Session_ID}&ServerUrl={!$Api.Partner_Server_URL_210}&LG3=2&LG4=0&DefaultPDF=1&Id={!CustomObject__c.Id}&TemplateId=a17n00000008aVS&FP0=1&OFN={!CustomObject__c.Name}+--+{!CustomObject__c.CustomField__c}+--+{!CustomObject__c.CustomField__c})','_blank','toolbar=yes, scrollbars=yes, resizable=yes, top=50, left=300, width=700, height=525' );" />
LG3=[0, 1 or 2]
Sets the file attachment options.
- If set to 0, "Attach File:" is "-None-" (default)
- If set to 1, "Attach File:" is "Attach to [record]" where [record] would be the type of master object record, e.g., “Opportunity”
- If set to 2, "Attach File:" is "Attach only, No Task Record"
LG4=[0 or 1]
Sets whether to automatically log an activity after merging.
- If set to 0, “Automatic Logging” is disabled (default)
- If set to 1, “Automatic Logging” is enabled
DefaultPDF=[0 or 1]
Sets the default output type to Adobe Acrobat.
- If set to 0, "Output Format" is "Same as template" (default).
- If set to 1, "Output Format" is "Adobe Acrobat".
Id=[id]
Sets the master object from which all fields are retrieved.
Note: A Conga Composer URL must contain one (and only one) instance of this parameter.
For example, the Id would be "&Id={!CustomObject__c.Id}".
FP0=[0, 1 or 2]
Locks the output file format.
- If set to 0, "Output Format" is "Same as template" and not locked (default).
- If set to 1, "Output Format" is "Adobe Acrobat" and the Output Format radio buttons are locked.
- If set to 2, “Output Format” is “Same as template” and the Output Format radio buttons are locked.
This is the unique record Id generated by Salesforce.com for the Conga Template. This parameter will select the template by default when included in the URL.
Note: You will need to update the TemplateId value if you create a new Conga Template record and/or if you use Change Sets between Orgs since the unique Id will change.
OFN=[text]
Sets the Output File Name, overriding the default output file name.
Note: This parameter is limited to 245 characters. You may use static text or merge field names for the values to place in the filename. Use a plus sign (+) to represent literal spaces. Do not include symbols unsupported in filesnames, “\”, “/”, “>”, “<”, etc.
Example:
...&OFN={!Account.Name}+-+Quote
If the Account name is “ABC Corp.”, the resulting file name would be "ABC Corp. – Quote.doc".
How do you setup a process to trigger automatic clicking on this button?
ReplyDelete