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
Krista KellyKrista Kelly 

Capture Comments in Submit for Approval button in an email

Hello, it's been requested that when our users hit the "Submit for Approval" button the Visualforce email that is sent to approver's also captures the Comments in the pop-up window that is written in the Process Instance step. Has anyone successfully done this? I found this code Capture Comments in Component
Capture Comments (https://gist.github.com/douglascayers/46bb1e92be9909d60fee)  and although it seems it should work the Comments are coming through as blank. The sql in the class does grab the comment I need. Even if I hard-code the Quote number in the Visualforce template when I save it previews the comments I need. Any advice would be appreciated! 

This is my Visualforce email
<messaging:emailTemplate subject="Quote Number: {!relatedTo.Name} Approval Request from: {!relatedTo.Opportunity_Owner__c} for {!relatedTo.Opportunity_Name_Without_Stage__c} totaling {!relatedTo.Formatted_Net_Amount__c}" recipientType="User" relatedToType="SBQQ__Quote__c" >
    <messaging:htmlEmailBody >
        <html>
            <head>
                <style type="text/css">
                .emph {
                    font-weight: bold;
                }
                
                </style>
            </head>
            <body>
                <br/>
                <div style="width: 90%;margin: 0 auto;">
                <!--
                    <p>Payment terms: <span style="font-weight: bold;">{!relatedTo.SBQQ__PaymentTerms__c}</span></p>
                    <p>Shipping terms: <span style="font-weight: bold;">{!relatedTo.Shipping_Terms__c}</span></p>
                    <p>Quote expiry date: <span style="font-weight: bold;">{!relatedTo.SBQQ__ExpirationDate__c}</span></p>
                    <p>Quote description: <span style="font-weight: bold;">{!relatedTo.Description__c}</span></p>
                    <p>Quote comments: <span style="font-weight: bold;">{!relatedTo.SBQQ__Notes__c}</span></p>
                    <p>Freight (if applicable): <span style="font-weight: bold;">{!relatedTo.Shipping_and_Handling__c}</span></p>
                    <p>Tax (if applicable): <span style="font-weight: bold;">{!relatedTo.Tax__c}</span></p>
                -->
                    <apex:OutputLabel value="Account Name: " /><apex:outputText style="font-weight: bold;" value="{!relatedTo.SBQQ__Account__r.Name}"/><br/>
                    <apex:OutputLabel value="Payment terms: " /><apex:outputText style="font-weight: bold;" value="{!relatedTo.SBQQ__PaymentTerms__c}"/><br/>
                    <apex:OutputLabel value="Shipping terms: " /><apex:outputText style="font-weight: bold;" value="{!relatedTo.Shipping_Terms__c}"/><br/>
                    <apex:OutputLabel value="Quote expiry date: " /><span style="font-weight: bold;"><apex:outputField value="{!relatedTo.Expiration_Date_formula__c}"/></span><br/>
                    <apex:OutputLabel value="Quote description: " /><apex:outputText style="font-weight: bold;" value="{!relatedTo.Description__c}"/><br/>
                    Comments: <c:ApprovalRequestComments relatedToId="{!relatedTo.Id}"/><br/>
                    <apex:OutputLabel value="Quote comments: " /><apex:outputText style="font-weight: bold;" value="{!relatedTo.Additional_Comments__c}" escape="false"/><br/>
                    <apex:OutputLabel rendered="{!!ISBLANK(relatedTo.Shipping_and_Handling__c)}" value="Freight: "/><span style="font-weight: bold;">
                    <apex:outputtext rendered="{!!ISBLANK(relatedTo.Shipping_and_Handling__c)}" value="{!relatedTo.SBQQ__Opportunity2__r.CurrencyISOCode}" />
                    <apex:outputText rendered="{!!ISBLANK(relatedTo.Shipping_and_Handling__c)}" value="{0, number, ###,###,###.00}">
                        <apex:param value="{!relatedTo.Shipping_and_Handling__c}" />
                    </apex:outputText></span><br/>
                    <apex:OutputLabel rendered="{!!ISBLANK(relatedTo.Tax__c)}" value="Tax: "/><span style="font-weight: bold;">
                    <apex:outputtext rendered="{!!ISBLANK(relatedTo.Tax__c)}" value="{!relatedTo.SBQQ__Opportunity2__r.CurrencyISOCode}" />
                    <apex:outputText rendered="{!!ISBLANK(relatedTo.Tax__c)}" value="{0, number, ###,###,###.00}">
                    <apex:param value="{!relatedTo.Tax__c}" />
                    </apex:outputText></span><br/>
                    <c:CPQQuoteDetails quote="{!relatedTo}"/><br/>
                    <apex:outputlink value="{!LEFT($Api.Partner_Server_URL_140,FIND('.com',$Api.Partner_Server_URL_140)+4)+relatedTo.Id}">Please click this link to approve or reject the record.</apex:outputlink>
                </div>
            </body>
        </html>

 
VinayVinay (Salesforce Developers) 
I don't think this feature is currently available.  Below is the Idea link.

https://trailblazer.salesforce.com/ideaView?id=08730000000BqAj

Thanks,
Krista KellyKrista Kelly
Hi Vinay, correct. I'm trying to create a workaround. It seems the person who I note in the link above has done it but for me the Comments are coming out blank (although if I hard-code my Quote Id in the Visual Force Template I can see the comments in Preview). Was just hoping someone out there has successfully done this customization and can provide advice. Thank you.