+ Start a Discussion
dselatdselat 

Visual force email template on opportunity

Hello Gurus,

 

I am new to Vf and looking for help to get this done quickly. The requirement is display company logo on header, then Opportunity Detail (layout as how it appears in salesforce) and the list of products. Has anyone done anything similar that i can leverage on? can i use apex tag?

 

Thanks in advance

Deepak

theitdeptrockstheitdeptrocks

Depending on the complexity of your object, this is sometimes a pain to code as a VF page.  I've found this app on the AppExchange to be a huge help.

 

http://appexchange.salesforce.com/listingDetail?listingId=a0N300000016kP8EAI

 

You can use that to replicate the existing layout as a Visualforce page which gives you a good starting point.  After that, it's a matter of adding your company logo and the products.

dselatdselat

I downloaded Easy Pages and am trying to create a vf layout but encounter the following error:

 

•an exception was caught
•Attempt to de-reference a null object 

 

any idea why?

dselatdselat

I managed to put together the following code:  but am encountering Error: <messaging:emailTemplate> cannot contain <apex:pageBlock>.

 

Below is my vf code for email:

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

<messaging:emailTemplate subject="Test - Opportunity Detail" recipientType="User" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<apex:page standardController="Opportunity">
    <apex:sectionHeader title="{!$ObjectType.Opportunity.label}" subtitle="{!Opportunity.name}"/>
    <apex:pageBlock title="{!$ObjectType.Opportunity.label} Detail">
        <apex:pageBlockButtons >
        <apex:form >
        </apex:form>
        </apex:pageBlockButtons>
        <apex:pageBlockSection showHeader="false" columns="2">
            <apex:outputField value="{!Opportunity.Opportunity_Number__c}"/>
            <apex:outputField value="{!Opportunity.Total_Amount_of_Opportunity__c}"/>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Opportunity Owner"/>
                <apex:outputPanel >
                    <apex:outputField value="{!Opportunity.OwnerId}"/>&nbsp;
                    <apex:outputLink value="{!URLFOR($Action.Opportunity.ChangeOwner,Opportunity.id)}">[Change]</apex:outputLink>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:outputField value="{!Opportunity.Amount}"/>
            <apex:outputField value="{!Opportunity.Name}"/>
            <apex:outputField value="{!Opportunity.Perpetual_Product_Roll_up__c}"/>
            <apex:outputField value="{!Opportunity.AccountId}"/>
            <apex:outputField value="{!Opportunity.Term_Product_Roll_up__c}"/>
            <apex:outputField value="{!Opportunity.Client_ID__c}"/>
            <apex:outputField value="{!Opportunity.SaaS_Product_Roll_up__c}"/>
            <apex:outputField value="{!Opportunity.Type}"/>
            <apex:outputField value="{!Opportunity.Membership_Product_Roll_up__c}"/>
            <apex:outputField value="{!Opportunity.Sales_Method__c}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.LeadSource}"/>
            <apex:outputField value="{!Opportunity.Training_Revenue__c}"/>
            <apex:outputField value="{!Opportunity.CampaignId}"/>
            <apex:outputField value="{!Opportunity.Training_Waived__c}"/>
            <apex:outputField value="{!Opportunity.ROI_Analysis_Complete__c}"/>
            <apex:outputField value="{!Opportunity.Training_Waived_Reason__c}"/>
            <apex:outputField value="{!Opportunity.NumDemos__c}"/>
            <apex:outputField value="{!Opportunity.Training_Waived_Explanation__c}"/>
            <apex:outputField value="{!Opportunity.Special_Handling__c}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.Revenue_Recognition_Review_Status__c}"/>
            <apex:outputField value="{!Opportunity.Support_Revenue__c}"/>
            <apex:outputField value="{!Opportunity.Legal_Review_Status__c}"/>
            <apex:outputField value="{!Opportunity.Conversion_Rate_at_Closure__c}"/>
            <apex:outputField value="{!Opportunity.Products_Are_Valid__c}"/>
            <apex:outputField value="{!Opportunity.CurrencyIsoCode}"/>
            <apex:outputField value="{!Opportunity.RevenueInstallments__c}"/>
            <apex:outputField value="{!Opportunity.CloseDate}"/>
            <apex:outputField value="{!Opportunity.Created_at_5_Percent_Stage__c}"/>
            <apex:outputField value="{!Opportunity.StageName}"/>
            <apex:outputField value="{!Opportunity.Push_Counter__c}"/>
            <apex:outputField value="{!Opportunity.CCS_Notes_In_this_Stage_you_should__c}"/>
            <apex:outputField value="{!Opportunity.Implementation_Date__c}"/>
            <apex:outputField value="{!Opportunity.Reason_for_Closed_Won__c}"/>
            <apex:outputField value="{!Opportunity.Related_Opportunity__c}"/>
            <apex:outputField value="{!Opportunity.Reason_Loss__c}"/>
            <apex:outputField value="{!Opportunity.Provisioning_Status_c__c}"/>
            <apex:outputField value="{!Opportunity.Notes_Description_for_Loss__c}"/>
            <apex:outputField value="{!Opportunity.Auto_Renewal_Opt_Out__c}"/>
            <apex:outputField value="{!Opportunity.Reason_for_Closed_Dormant__c}"/>
            <apex:outputField value="{!Opportunity.Contract_End_Date1__c}"/>
            <apex:outputField value="{!Opportunity.Reason_for_Sales_Rejected__c}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.Sales_Rejected_Explanation__c}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.Probability}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.NextStep}"/>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!Opportunity.BVA__c}"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection showHeader="true" title="Useful Links" columns="3">
        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:relatedList list="OpportunityLineItems"/>
</apex:page>

</messaging:htmlEmailBody>
</messaging:emailTemplate>

dselatdselat

Looks like you can't use all the apex components in vf email templates like <apex:pageBlockButtons>

Has anyone been able to get the look n feel of sf.com on their email template?