You need to sign in to do that
Don't have an account?

how to send the notes title and body of custom record to paricular email
Hi I need to send the custom object record Notes Title and Body to the particular mail id my code
public with sharing class mail
{
public mail(ApexPages.StandardController controller)
{
string save=ApexPages.currentPage().getParameters().get('id');
List<NotesAndAttachments> n=[Select Title,Body From Brand__c.NotesAndAttachments Where parentid='01Ii0000001aNoy'];
}
public PageReference Send()
{
String[]address=new String[] {sinffer@gmai.com'};
Messaging.SingleEmailMessage emails = new Messaging.SingleEmailMessage();
emails.setTargetObjectId('005i0000002nxZ6');
emails.setTemplateId('00Xi0000000J9hx');
emails.SaveAsActivity=(false);
emails.setsubject('Simple Subject');
emails.setplaintextbody('simple');
emails.setToAddresses(address);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emails });
return null;
}
when im using this code im getting error like this ::First SObject of the FROM statement must be a valid SObject type. at line 11 column 29
can any one help out from this
public with sharing class mail
{
public mail(ApexPages.StandardController controller)
{
string save=ApexPages.currentPage().getParameters().get('id');
List<NotesAndAttachments> n=[Select Title,Body From Brand__c.NotesAndAttachments Where parentid='01Ii0000001aNoy'];
}
public PageReference Send()
{
String[]address=new String[] {sinffer@gmai.com'};
Messaging.SingleEmailMessage emails = new Messaging.SingleEmailMessage();
emails.setTargetObjectId('005i0000002nxZ6');
emails.setTemplateId('00Xi0000000J9hx');
emails.SaveAsActivity=(false);
emails.setsubject('Simple Subject');
emails.setplaintextbody('simple');
emails.setToAddresses(address);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emails });
return null;
}
when im using this code im getting error like this ::First SObject of the FROM statement must be a valid SObject type. at line 11 column 29
can any one help out from this
I don't understand your requirement properly, are there fields with the name Title and Body in a custom object which you wish to refer in email?
If yes, then you can achieve this by using merge fields. Refer: https://help.salesforce.com/HTViewHelpDoc?id=merge_fields_email_templates.htm&language=en_US
Thanks for ur reference link but my requeriment is i just need to take the notes and attachment which we have in related list fields that i want to fetch it with my mail which im going to send . title and body is not in my object field its in notes and attachment field that i wan to send
With standard functinality it is not possible and there is an idea for the same on ideaexchange. Please refer following thread addressing similar requirement:
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yN4IAI
Idea link: https://success.salesforce.com/ideaView?id=08730000000BpSJAA0
Thanks for your reference vinita