+ Start a Discussion
MaggieSumitMaggieSumit 

Is there anyway to send VF email template as a attachment to account email address

I want to send Visualforce Email Template as a pdf to records (parent Account object email field and Invoice object email address) whenever a new child record created --- by trigger or process builder.
VinayVinay (Salesforce Developers) 
Hi Sumit,

Yes you can send,  Review below links that can help you.

https://salesforce.stackexchange.com/questions/150126/saving-email-template-as-pdf-attachment-to-record
https://www.sfdclessons.com/2019/01/how-to-attach-visualforce-component-as.html
https://www.greytrix.com/blogs/salesforce/2017/07/20/sending-email-attachment-using-vf-email-template/

Thanks,
Vinay Kumar
Yamala  HareeshYamala Hareesh
Hi Sumit,

Wanted to update few fields by trigger from parent object when new child record is created in salesforce.
 
Trigger ChildUpdate on Childobject__c(Before Insert)
{
    Set<Id> ParentIds = New Set<Id>();

    For(Childobject__c C : Trigger.New)
    {
        ParentIds.Add(C.ParentId__c);
    }

    List<ParentObjectName__c> ParentList = [Select Id,Address__c from ParentObjectName__c where id =: ParentIds];

    For(Childobject__c CO : Trigger.New)
    {    
        For(ParentObjectName__c PA : ParentList)
        {
            IF(CO.ParentId__c == PA.ID)
            {
                IF(PA.Address__c != NULL)
                {
                    C.ChildAddressField__c = PA.Address__c ;
                }
            }
        }
    }    
}

Thanks 
Yamala H@reesh