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
b.gonzalezb.gonzalez 

My output link in my VF email template is not working?

I created a VF email template.  However the link appears in the email but when you click on the link. The link does not work.

Not sure what is wrong with my code for the link. See code:

<apex:outputLink value="/!{relatedTo.opp}">{!relatedTo.Name}</apex:outputLink>

 Here is the first part of my VF email template for your reference.

<messaging:emailTemplate recipientType="User"relatedToType="Opportunity" subject="Channel Special Pricing Approval Request: {!relatedTo.name}">
<messaging:htmlEmailBody >       
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 14px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 14px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE></p>
                  <font face="arial" size="3">
        <p>Dear Approver,</p><p>A new Channel Special Pricing Request has been submitted for your review and is pending your approval.The link provided will take you to the opportunity in Salesforce.com. If you are receiving this on your mobile devise, a summary of the opportunity details follows below the link.</b></p>
      
        <p>You can approve or deny this request from your mobile devise by replying to this message and typing approved or rejected in the first line of the email body. You may add any additional comments in the second and subsequent lines. The additional comments will be added to your approval or denial record.</p>
          <apex:outputLink value="/!{relatedTo.opp}">{!relatedTo.Name}</apex:outputLink>
        <br></br>
        <table border="0" >
                 <tr >
                     <th>Action</th><th> Product Name </th><th> Quantity </th><th> Disti Price $ </th><th> Discount %</th><th> Discount Price $ </th>
                 </tr>
    <apex:repeat var="opp" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td><a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}">View</a> | 
           <a href="https://na1-blitz01.soma.salesforce.com/{!opp.id}/e">Edit</a></td>
           <td>{!opp.PriceBookEntry.name}</td>
           <td>{!ROUND(opp.Quantity,0)}</td>
           <td>{!ROUND(opp.ListPrice,0)}</td>
           <td>{!ROUND(opp.Discount__c,0)}</td>
           <td>{!ROUND(opp.Approved_Unit_Price__c,0)}</td>
           </tr>
    
    </apex:repeat>                
       </table>
       <br/>” 

 

Best Answer chosen by Admin (Salesforce Developers) 
hpereirahpereira

Hello b.gonzalez,

 

Try this instead:

 

<apex:outputLink value="/{!relatedTo.opp}">{!relatedTo.Name}</apex:outputLink>

 

A small miscorrection :)

 

Regards

All Answers

hpereirahpereira

Hello b.gonzalez,

 

Try this instead:

 

<apex:outputLink value="/{!relatedTo.opp}">{!relatedTo.Name}</apex:outputLink>

 

A small miscorrection :)

 

Regards

This was selected as the best answer
hpereirahpereira

Hello b.gonzalez,

 

Did my tip help you to solve your problem?

 

Regards,

b.gonzalezb.gonzalez
Yes it did! Thank you!