How to generate a Text file using apex in Salesforce?

Sample Code:

        Employee__c e = [SELECT Name from Employee__c WHERE Id = : eid];
        Attachment a = new Attachment();
        a.ParentId = eid;
        a.Name = e.Name + Date.Today();
        a.ContentType = 'text/plain';
        a.Body = Blob.valueOf(e.Name);
        insert a;


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit