Created
September 5, 2014 16:43
-
-
Save keirbowden/050b1e71335e4a25f3be to your computer and use it in GitHub Desktop.
Extension controller to save an attachment associated with a record encapsulated in the standard controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class AddAttachmentExt | |
{ | |
private ApexPages.StandardController stdCtrl; | |
public Attachment att {get; set;} | |
public AddAttachmentExt(ApexPages.StandardController inStd) | |
{ | |
stdCtrl=inStd; | |
att=new Attachment(); | |
} | |
public PageReference AddAttachment() | |
{ | |
att.ParentId=stdCtrl.getId(); | |
insert att; | |
PageReference pr=new PageReference(ApexPages.currentPage().getUrl()); | |
pr.setRedirect(true); | |
return pr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment