You need to sign in to do that
Don't have an account?
Rick-Proface
Fatal Error in Sales Force
I'm gettting a Fatal Error in Sales Force and I'm not sure what this means. Here's the class I have in Eclipse, it is a chunk taken from another class that I wanted to shorten as I only need this functionality.
Thanks for any help.
public with sharing class attachQuoteSPF { private ApexPages.StandardController controller; Private id quoteid; public attachQuoteSPF (ApexPages.StandardController c) { controller = c; quoteid = c.getRecord().id; } /* The action method that will generate a PDF document from the QuotePDF page and attach it to the quote provided by the standard controller. Called by the action binding for the attachQuote page, this will do the work and take the user back to the quote detail page. */ public PageReference attach() { /* Get the page definition */ PageReference quotePDF = Page.SpecialPricePDF; /* set the quote id on the page definition */ quotePDF.getParameters().put('id',quoteid); /* generate the pdf blob */ Blob pdfBlob = quotePDF.getContentAsPDF(); /* create the attachment against the quote */ Attachment a = new Attachment(parentId = quoteid, name= 'quotePDF.pdf', body = pdfBlob); /* insert the attachment */ insert a; /* send the user back to the quote detail page */ return controller.view(); } //****************** //Test Method //****************** public static testMethod void TestattachQuoteSPF() { // Insert test Quote Quote testQuote = new Quote ( Name = 'Test Quote2', OpportunityId = '0068000000VFfSN', SAP_Code__c ='C000000'); insert testQuote; // Instantiate VisualForce Page PageReference pg = Page.SpecialPricePDF; Test.setCurrentPage(pg); ApexPages.currentPage().getParameters().put('id', testQuote.id); // Instantiate attachQuote controller ApexPages.StandardController c = new ApexPages.standardController(testQuote); attachQuoteSPF qe = new attachQuoteSPF(c); qe.attach(); } }