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
shalushalu 

account is created add the any of the attachment in that using trigger

Best Answer chosen by shalu
sfdcMonkey.comsfdcMonkey.com
Hi try following trigger which is create a text attachment on account creation 
trigger insertAtt on Account (after insert) {
  List<Attachment > lstAtt = new List<Attachment>();

  Blob attachmentBody = Blob.valueOf('Test Attachment Body'); // add your attachment body data here in blob var
   
for(account acc : trigger.new){
      Attachment temporaryAttachment = new Attachment();
        temporaryAttachment.Body = attachmentBody;
        temporaryAttachment.Name = 'My Test Att.txt';
        temporaryAttachment.ParentID = acc.Id;
        lstAtt.add(temporaryAttachment);
   } 
      
      insert  lstAtt ;
 
}

Thanks, let us know if it helps you 

All Answers

Avishek Nanda 14Avishek Nanda 14
HI Swathy,

Could you please describe the use case so that would be able to provide a solution.

Regards,
Avishek
sfdcMonkey.comsfdcMonkey.com
Hi try following trigger which is create a text attachment on account creation 
trigger insertAtt on Account (after insert) {
  List<Attachment > lstAtt = new List<Attachment>();

  Blob attachmentBody = Blob.valueOf('Test Attachment Body'); // add your attachment body data here in blob var
   
for(account acc : trigger.new){
      Attachment temporaryAttachment = new Attachment();
        temporaryAttachment.Body = attachmentBody;
        temporaryAttachment.Name = 'My Test Att.txt';
        temporaryAttachment.ParentID = acc.Id;
        lstAtt.add(temporaryAttachment);
   } 
      
      insert  lstAtt ;
 
}

Thanks, let us know if it helps you 
This was selected as the best answer
shalushalu
thank you so much 
Piyush_soni__
shalushalu
if would like to attach PDF form means..?