You need to sign in to do that
Don't have an account?
Ryan Greene
get id from void method and redirect to newly created id
Hello,
I have a button on my page which runs a VF Page with an extension to my controller. It works to press the button and it produces the EchoSign Agreement as directed. However, the page it goes to when I click the button is a blank page. I would like to redirect it to the Id of the record I just created upon pressing the button. Basic outline of code below. So how can I get a void method to redirect to the ID of the record it just created?
I have a button on my page which runs a VF Page with an extension to my controller. It works to press the button and it produces the EchoSign Agreement as directed. However, the page it goes to when I click the button is a blank page. I would like to redirect it to the Id of the record I just created upon pressing the button. Basic outline of code below. So how can I get a void method to redirect to the ID of the record it just created?
public void SendPdf(){ //reference PDF Creator VF Page pageReference pdfPage = Page.ContactPDF; pdfPage.getParameters().put('Id',getid); blob pdfBody; pdfBody = pdfPage.getContentAsPDF(); // Build Echosign agreement record echosign_dev1__SIGN_Agreement__c agreementRec = new echosign_dev1__SIGN_Agreement__c(); agreementRec.Name = 'Credit Info Release for: '; //other variables entered here insert agreementRec; // insert the pdf as an attachment attachment pdfFile = new attachment(); pdfFile.isPrivate = false; pdfFile.body = pdfBody; pdfFile.parentId = agreementRec.id; pdfFile.Name = 'Agreement.pdf'; insert pdfFile; }
Mark it as Best Answer, if it helps
:
All Answers
Mark it as Best Answer, if it helps
:
Works great, thank you!