You need to sign in to do that
Don't have an account?
SFDC@Error
Dynamic pdf name in attachment
Hi All
I have created a controller and vf page.when i am creating record file attaching in notes and attachment with static name.like test.pdf.How can i create dynamic name for pdf name for example object__c.Name.pdf.
I have created a controller and vf page.when i am creating record file attaching in notes and attachment with static name.like test.pdf.How can i create dynamic name for pdf name for example object__c.Name.pdf.
public class AttachPDF { private final Id recordId; public AttachPDF_Controller(ApexPages.StandardController controller) { recordId = controller.getId(); system.debug('inside AttachPDF'); } @future(callout = true) public static void save(Id AccId, String acctName){ system.debug('inside AttachPDF save'); PageReference pdf = new PageReference('/apex/PDFPage?id='+Accid); pdf.setRedirect(true); pdf.getParameters().put('Id',AccId); Blob b= pdf.getContent(); Attachment formAttach = new Attachment(); formAttach.Name = 'test'+'.pdf'; formAttach.body = b; formAttach.ContentType='application/pdf'; formAttach.parentId =AccId; insert formAttach; } }
Please try like below example Thanks
Hemant
Trigger
Class
Let me know if it dnt work
Thanks
Hemant