function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikhil PoteNikhil Pote 

send email using conga workflow with Visualforce page button

Very urgent: How to send email using conga workflow with Visualforce page button? I have created VF page to send email using conga & added it on Quote. After Merge & email, when I click send button on standard email template it redirects me to standard email template again. I want send with attachment functionality when I click send & page should redirect to Quote Id. Please help,its very urgent.
This is the page I'm getting after Merge & email of conga after adding mail To when I click on Send button I'm getting redirected to following screen This is the page I'm getting redirected after click send

Note: it works fine if I do it from javascript button but I want it in VF so that I can use it in Salesforce1


Code snippet:

VF(This VF is used as Source for button)

<apex:page StandardController="Quote" extensions="EmailQuoteExtension" action="{!sendQuoteEmail}">
</apex:page>

Controller

public with sharing class EmailQuoteExtension {
//SessionUrl__c & Session_Id__c are custom formula fields to get server Url & session Id respectively  
    Id QuoteID;
    public EmailQuoteExtension(ApexPages.StandardController controller) {
        QuoteID = ApexPages.currentPage().getParameters().get('id');
    }
    
    public Pagereference sendQuoteEmail() {   
        list<Quote> lstQuote = [SELECT QuoteNumber,
                                       SessionUrl__c,
                                       Session_Id__c 
                                FROM Quote 
                                WHERE ID=: QuoteID limit 1];
        string quoteStr = 'https://composer.congamerge.com?sessionId='+lstQuote[0].Session_Id__c;
        quoteStr +='&serverUrl='+lstQuote[0].SessionUrl__c+'&id='+QuoteID;
        quoteStr +='&QueryId=[QuoteLineItem]a0iO0000009kbkH?pv0='+QuoteID;
        quoteStr +='&OFN= Quote+Creation+-+'+lstQuote[0].QuoteNumber;
        quoteStr +='&TemplateId=a0hO00000050y5C&DefaultPDF=1&SF1=1&SC1=Attachments&SC0=1&EmailToId&EmailSubject=Quote+'+lstQuote[0].QuoteNumber;
        pagereference pg = new pagereference(quoteStr);
        system.debug('quoteStr----'+quoteStr);
        pg.setRedirect(true);
        return pg;
    }
}