• Sushant.Chavan
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Hi,

 

I have a simple VF Template that I'm sending from workflow that triggers on a custom object.  This custom object is related to Contact via a Master Detail, and I selected this M-D field as the recipient in the Email Alert Workflow Action as the "Related Contact" option.

 

When I send the email from the custom object record, by hitting "Send an Email," all goes as planned and my Recipient fields merge beautifully.  However, when the email gets  sent via the workflow email alert, none of my Recipient fields merge.  This is an issue because I want to show a table of related child objects from the Contact.

 

Any ideas?  I'm beginning to think the Recipient functionality doesn't work from workflow, or at least not workflow sent to related Contacts.

 

Thanks,

 Drew 

Hi All -

 

I am new, so please forgive my green - but I am having a perplexing problem in generating a Visual Force email template showing related lists for a custom object.

 

I CAN get a list of Cases related to an Account with no problem, but when I put in a custom object  (Child Relationship Name "Suppliers") which is also (Master-Detail) related to Account I get the following error: Error: Invalid field Suppliers for SObject Account

 

I have tried everything I can think of - using API name instead, appending "__c" to the end, but it seems that i can't make any lists at all with custom objects in this code.

 

Is there a restriction within this type of code that allows only lists with standard objects or is there something I'm missing?

 

Any help would be greatly appreciated. I am not good enough to make a custom Apex controller yet and a little under the gun to kluge something together.

 

Thanks much,

 

Lex

 

Below is relevant code:

 

 

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Account"
    subject="Supplier report for Account: {!relatedTo.name}"
    replyTo="support@acme.com" >
<messaging:htmlEmailBody >   
<html>
    <body>
     <STYLE type="text/css">
           TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
           TD  {font-size: 11px; font-face: verdana }
           TABLE {border: solid #CCCCCC; border-width: 1}
           TR {border: solid #CCCCCC; border-width: 1}
     </STYLE>
         <font face="arial" size="2">
      <p>Dear {!recipient.name},</p>
      <p>Below is a list of supplier records related to the account: {!relatedTo.name}.</p>
<table border="0" >
        <tr >
            <th>Action</th><th>Product</th><th>Status</th><th>Creator Email</th><th>BL date</th>
         </tr>
<apex:repeat var="cx" value="{!relatedTo.Suppliers}">
   <tr>
       <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |  
       <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
(...snip...)

 

 

I'm trying to send a Visualforce email template with custom object information that also lists out some child items. It's a pretty simple idea, but I'm getting a compile error because it doesn't like my child object reference. Can anyone help me correct this? I have bolded the problem line.

 

 

<messaging:emailTemplate subject="Changeover Order Form APPROVED"
recipientType="User" relatedToType="Changeover_Order_Form__c">
<messaging:plainTextEmailBody >

Details:
Account: {!relatedTo.Account__c}

Ingoing Order Amount: {!relatedTo.Ingoing_Order_Amount__c}
Package: {!relatedTo.Package_Options__c}
Gift Card Level: {!relatedTo.Gift_Card_Level__c}
Gift Card dollars used: {!relatedTo.Total_Gift_Card_dollars_used__c}

GIFT CARD SELECTION:
<apex:repeat var="gx" value="{!relatedTo.Gift_Card_Selection}">
Vendor: {!gx.Vendor_Card__c} ] - # of Cards: {!gx.of_Cards__c} ]
</apex:repeat>

View the record: http://www.salesforce.com/{!relatedTo.Id}

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

 

I made sure that the Child Relationship Name field was filled in with "Gift_Card_Selection."

Am I missing something else?