• sbaja
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi Everyone,

 

I have created a visualforce email template where i need to send the meeting details to the lead.


<messaging:emailTemplate recipientType="Lead" relatedToType="Event" subject="abc" replyTo="abc@abc.com" >

 

I am using the trigger to send that mail , where i had written some code like :

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

 mail.setSaveAsActivity(false);
mail.setToAddresses(toAddresses);
 mail.setCcAddresses(ccAddresses);
mail.setTargetObjectId(lead.Id);
mail.setWhatId(event.id);
mail.setTemplateId([select id from EmailTemplate where Name=: template].Id);
 Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail });  

 

 

but I am getting exception "First exception on row 0; first error: INVALID_ID_FIELD, Only accounts, assets, campaigns, cases, contracts, opportunities, orders, products, solutions and custom objects are allowed as whatId.: "

 

 I had also tried to create a custom object and populating the event merge fields of template in that and tried to access that.

That is alos giving exception Invalid Field Reference.

 

Can you please tell me the work around that why it is not accepting event id.
Is there any other way to solve this issue.??

when I send test mail through template, it accept the id and merge all the fields. but giving exception when doing it through trigger.

 

Kindly Help me

 

  • January 10, 2011
  • Like
  • 0

Hi

 

I need to create a report on the Custom/Standard Object in which i need to know that record has Attachment or not.

I have to filter the custom/Standard Object records though the attachment in the reports.Is the any way to relate sObject with the Attachment object in the Reports.

 

Need help for this.

 

Thanks.

  • January 06, 2011
  • Like
  • 0

Hi

 

I have created a Visualforce email template and sending that mail template through a trigger.

I have loaded all the images that I am using in my template as the static resource and accessing it like

 

<apex:image url="{!URLFOR($Resource.Zipfolder, 'folder/image1.jpg')}" width="25" height="100" />

In the preview of the template, I am able to see the images. And the cache control for the static resource is public.

Even though I am not able to see Image in the mail delivered to the recipient.

 

needed help on this.

  • January 06, 2011
  • Like
  • 0

I am sending some outbound Messages through a trigger, where I have used setHtmlBody method for formulating the body of the Email . I want these outbound messages to be sent in multiple languages as per the country code of the recipient.

I don't want to code this method for each language, Is there any direct method or function which convert  its text as per country code.

Can anyone help me how to achieve this in trigger.

 

Thanks in advance :)

  • December 27, 2011
  • Like
  • 0

Hi

 

I have created a Visualforce email template and sending that mail template through a trigger.

I have loaded all the images that I am using in my template as the static resource and accessing it like

 

<apex:image url="{!URLFOR($Resource.Zipfolder, 'folder/image1.jpg')}" width="25" height="100" />

In the preview of the template, I am able to see the images. And the cache control for the static resource is public.

Even though I am not able to see Image in the mail delivered to the recipient.

 

needed help on this.

  • January 06, 2011
  • Like
  • 0

I can't seem to create an Event Button that populates a VF Email Template with event details using Professional Edition.

 

.  Here is the button.

 

"/_ui/core/email/author/EmailAuthor?p2_lkid={!Event.Who}&p3_lkid=&p4=&p5=&p24=&cancelURL=/{!Event.Id }&retURL=/{!Event.Id}&template_id=00XA0000000eyxo&recipient_type_id={!Event.Who}&related_to_id={!Event.Id}"

 

Putting the p3_lkid={!Event.Id} produces an error "Invalid parameter" due to the EmailAuthor doesn't seem to allow Events as a valid p3_lkid.

 

Here is the VF Email Template.

<messaging:emailTemplate subject="Appointment Confirmation" recipientType="Contact" relatedToType="Event">

<messaging:htmlEmailBody >
<p>Dear {!recipient.Name},
<br/>
<br/>
This is a reminder of an appointment that is scheduled.  Details are:
<br/>
<br/>
Appoinment: {!relatedTo.Subject}
<br/>
<apex:outputText value="Date: {0,date}">
<apex:param value="{!relatedTo.StartDateTime}"/>
</apex:outputText>
<br/>
<apex:outputText value="Time: {0,time,short}">
<apex:param value="{!relatedTo.StartDateTime}"/>
</apex:outputText>
<br/>
Company: {!relatedTo.What.Name}
</p>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

The template populates fine when using the Send Test and Verify Merge Fields, but not using the button.  Any ideas?

Thanks.

  • June 08, 2010
  • Like
  • 0