You need to sign in to do that
Don't have an account?
Wes McCarthy
VisualForce Email Template - Issue getting related list details
Hi there,
My opportunity has a related object called "Resource Request". A Resource Request record gets automatically created when the Opp reaches a certain stage. When this happens, i would like to send an email to relevant parties, notifying them that a resource record has been created in relation to the associated Opportunity. I want the email to list details about the Opp, Line Items and have a link to the Resource Request object. The issue im having is getting the link to the Resource Request object. My VF html code lis below. I've tried to setup a workflow rule from the Resource Request to write back its ID to the Opp, once created, however this isnt allowed. I am getting an error in my current VF code because it doesnt accept "Resource_Request__c" as a valid association to an Opportunity.
Some more details.
- I wanted Resource Request to be a child of the Opp, but was unable to. Received an error message that could not create a parent child relationship with the Opp, as the Opp object was already in existance.
- Instead i created a LookUp from the Resource Request to the Opp, so that the Resource Request appears as a related list on the Opp. NOTE: There will ever only be a 1:1 relationship between the Opp and Resource Request.
Any help is much appreciated.
Thanks
<messaging:emailTemplate recipientType="User"
relatedToType="Opportunity"
subject="{!relatedTo.Job_Code__c} - Resource Request">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: left }
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>Hi team,</p>
<p>I need some resources to fill the below requirements.</p>
<table border="1" >
<tr>
<th align="left">Job Code</th>
<td align="left">{!RelatedTo.Job_Code__c}</td>
</tr>
<tr>
<th align="left">Opportunity Name</th>
<td align="left">{!RelatedTo.Name}</td>
</tr>
<tr>
<th align="left">Account Name</th>
<td align="left">{!RelatedTo.Account.Name}</td>
</tr>
<tr>
<th align="left">Region</th>
<td align="left">{!RelatedTo.Region__c}</td>
</tr>
</table>
<p>Product Details.</p>
<table border="1" >
<tr >
<th align="left">Product Name</th>
<th align="left">Description</th>
<th align="left">No. of Days Needed</th>
<th align="left">Start Date</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td align="left">{!cx.PriceBookEntry.name}</td>
<td align="center">{!cx.Description}</td>
<td align="center">{!cx.Quantity}</td>
<td align="left"><apex:outputText value="{0, date, EEE, MMMM d, yyyy}"><apex:param value="{!cx.ServiceDate}"/></apex:outputText></td>
</tr>
</apex:repeat>
<apex:repeat var="RR" value="{!relatedTo.Resource_Request__c}">
</apex:repeat>
</table>
<p>You can navigate to the Opportunity via the following link: <a href="{!LEFT($Api.Partner_Server_URL_290,FIND('services',$Api.Partner_Server_URL_290)-1)}{!RR.Id}">{!relatedTo.Name}</a></p>
</font>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:plainTextEmailBody >
Hi team,
I need some resources to fill the below requirements.
[ Product Name] - [ No of Days Needed ] - [ Start Date]
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
[ {!cx.PriceBookEntry.name} ] - [ {!cx.Quantity} ] - [ {!cx.ServiceDate} ]
</apex:repeat>
For more information login to http://www.salesforce.com
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
My opportunity has a related object called "Resource Request". A Resource Request record gets automatically created when the Opp reaches a certain stage. When this happens, i would like to send an email to relevant parties, notifying them that a resource record has been created in relation to the associated Opportunity. I want the email to list details about the Opp, Line Items and have a link to the Resource Request object. The issue im having is getting the link to the Resource Request object. My VF html code lis below. I've tried to setup a workflow rule from the Resource Request to write back its ID to the Opp, once created, however this isnt allowed. I am getting an error in my current VF code because it doesnt accept "Resource_Request__c" as a valid association to an Opportunity.
Some more details.
- I wanted Resource Request to be a child of the Opp, but was unable to. Received an error message that could not create a parent child relationship with the Opp, as the Opp object was already in existance.
- Instead i created a LookUp from the Resource Request to the Opp, so that the Resource Request appears as a related list on the Opp. NOTE: There will ever only be a 1:1 relationship between the Opp and Resource Request.
Any help is much appreciated.
Thanks
<messaging:emailTemplate recipientType="User"
relatedToType="Opportunity"
subject="{!relatedTo.Job_Code__c} - Resource Request">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: left }
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>Hi team,</p>
<p>I need some resources to fill the below requirements.</p>
<table border="1" >
<tr>
<th align="left">Job Code</th>
<td align="left">{!RelatedTo.Job_Code__c}</td>
</tr>
<tr>
<th align="left">Opportunity Name</th>
<td align="left">{!RelatedTo.Name}</td>
</tr>
<tr>
<th align="left">Account Name</th>
<td align="left">{!RelatedTo.Account.Name}</td>
</tr>
<tr>
<th align="left">Region</th>
<td align="left">{!RelatedTo.Region__c}</td>
</tr>
</table>
<p>Product Details.</p>
<table border="1" >
<tr >
<th align="left">Product Name</th>
<th align="left">Description</th>
<th align="left">No. of Days Needed</th>
<th align="left">Start Date</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td align="left">{!cx.PriceBookEntry.name}</td>
<td align="center">{!cx.Description}</td>
<td align="center">{!cx.Quantity}</td>
<td align="left"><apex:outputText value="{0, date, EEE, MMMM d, yyyy}"><apex:param value="{!cx.ServiceDate}"/></apex:outputText></td>
</tr>
</apex:repeat>
<apex:repeat var="RR" value="{!relatedTo.Resource_Request__c}">
</apex:repeat>
</table>
<p>You can navigate to the Opportunity via the following link: <a href="{!LEFT($Api.Partner_Server_URL_290,FIND('services',$Api.Partner_Server_URL_290)-1)}{!RR.Id}">{!relatedTo.Name}</a></p>
</font>
</body>
</html>
</messaging:htmlEmailBody>
<messaging:plainTextEmailBody >
Hi team,
I need some resources to fill the below requirements.
[ Product Name] - [ No of Days Needed ] - [ Start Date]
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
[ {!cx.PriceBookEntry.name} ] - [ {!cx.Quantity} ] - [ {!cx.ServiceDate} ]
</apex:repeat>
For more information login to http://www.salesforce.com
</messaging:plainTextEmailBody>
</messaging:emailTemplate>