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
Guru Vemuru 1Guru Vemuru 1 

Problem in feching data from User in Visual Force Email template?

Hi all,
 I am creating Visualforce  email template to add Signature, whenever user send mail other people.
1.In that template i have to fetch uer data like NAME, DIVISION...   .
2.So I created fields in User object and trying to fetch data from user object.
3.when Use send test and verify merge fields showing data,But when we send mail from contact it is fetch data from user .
4. And logo also not displaying.

Here is my code:

<messaging:emailTemplate subject="Regarding Student" recipientType="Lead" relatedToType="user">
<messaging:plainTextEmailBody >

{!RelatedTo.FirstName} {!RelatedTo.LastName}
_____________________________________________
Continental
Division  {!RelatedTo.Division__c}
Segment   {!RelatedTo.Segment__c}
Rechnungsanschrift/Billing address {!RelatedTo.Billing_Address__c}
Mobile            {!RelatedTo.MobilePhone}
Email             {!RelatedTo.Email}  
Visit us @        {!RelatedTo.URL__c}
______________________________________________

http://www.continental-corporation.com  

<img src="https://testguru--test1--c.cs50.visual.force.com/resource/1509087818000/Contitechtest"
    width="200" height="200"/>

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

Privew:

Guru 
_____________________________________________
Continental 
Division  
Segment   IT
Rechnungsanschrift/Billing address Jeevan Bhema Nagar
Mobile            (
Email             vguru.com 
Visit us @        www. guru.com
______________________________________________

http://www.continental-corporation.com  

<img height="200" src="https://testguru--test1--c.cs50.visual.force.com/resource/1509087818000/Contitechtest" width="200" />
 
Balayesu ChilakalapudiBalayesu Chilakalapudi
Query User's data in devconsole to check whether it exists or not like this
SELECT FirstName,LastName,Division__c,Segment__c,Billing_Address__c,MobilePhone,Email,URL__c FROM User WHERE Id='give user Id here'
Copy the image link and paste in browser's new tab and check whether it is loading or not. I guess the image link must be like
https://na2.ap4.content.force.com/servlet/servlet.FileDownload?file=0156F00000DNU6E
 
Guru Vemuru 1Guru Vemuru 1
Thank you Chilakalapudi,

In developer console I am able fetch data.
User-added image