• mktforce
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hello,

 

I am beginning to learn visualforce and am stumped at a point in creating a visualforce email template.

 

My hope was to come up with an email template that could be used in the opportunity object so that when I enter a new opportunity with products listed in the opportunity line items related list the contact would receive an email that would act as an order confirmation. I am stuck while trying to figure out how to list the products in the opportunity line items list.

 

Below is what I was attempting to use. I was trying to mirror the use of the repeat component that was used in some example code that I found on developerforce. My problem is that it continues to say that Product is not a standard object of OpportunityLineItems. I see that Product is a lookup field and the field name shows as "Product2". Any thoughts?

 

Thanks, Nick

 

<messaging:emailTemplate subject="Equipment Order Confirmation" recipientType="Contact" relatedToType="Opportunity">
<messaging:plainTextEmailBody >

Dear {!recipient.name},

The following is confirmation of your equipment order:

Return Date: {! RelatedTo.Return_Date__c}

Equipment Requested
          [ Case Number ] - [ Subject ] - [ Email ] - [ Status ]
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
         {!cx.Product2}     {!cx.Quantity}
</apex:repeat>
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

I'm new to Visualforce and APEX;

 

Here is some background on what I am trying to do - Each Account is assigned either "Agency" or "Client" picklist values under the "Type" field. (I am using Professional edition, so I am not able to create different Account Record Types). My company's Opportunities always relate to TWO Accounts - one of each type. I currently have the Opportunity Account Name field looking up Agency Accounts and a custom look up field to assign the Client Account.

 

The issue I have is displaying redundant Related Lists on the Account Page - for "Agency" accounts, this is fine.. the Opportunities show up under "Opportunities" related list. For Client Accounts, however, the related Opportunities display on a separate related list created by the custom look up field.

 

Any direction on the best way to tackle this is appreciated - below I've listed my ideas, but I don't know how to execute any of them (I'm shuffling around in the Visualforce inline page documentation but quite confused...) Also - please let me know if what I am trying to do requires Enterprise.

-HIDE empty related list

-DISPLAY related list based on Account Type Field value (using an inline visualforce page?)

-restructure how i point opportunities to multiple accounts..

  • November 16, 2010
  • Like
  • 0