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
vivek ravivivek ravi 

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[] {'}; 
    Messaging.SingleEmailMessage emails = new Messaging.SingleEmailMessage();
    emails.setsubject('Simple Subject');
    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:
vivek ravivivek ravi
Hi vinita
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:

Idea link:
vivek ravivivek ravi
i have checked this link
Thanks for your reference vinita