Attachment Insert in Apex class

PHOTO EMBED

Sat May 07 2022 08:21:30 GMT+0000 (Coordinated Universal Time)

Saved by @pradeepkumar28 #javascript

Blob b = Blob.valueOf('Test Data');
    	
Attachment attachment = new Attachment();
attachment.ParentId = parentId;
attachment.Name = 'Test Attachment for Parent';
attachment.Body = b;

insert(attachment);
content_copyCOPY