• Miller91
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies

 

I'm having a huge difficulty writing the test for this class,

I thought something like this would work, but I have no idea how to get the standard controller from the current apex page. Any help would be appreciated.

 

public class MultiChequeController {

    public List<Printer_Builder__c> cheques {get; set;}
    private final CM_Cheque_Printer__c cp;
    
    public MultiChequeController(ApexPages.StandardController myController) {
        cp=(CM_Cheque_Printer__c)myController.getrecord();
        cheques = new List<Printer_Builder__c>();
        cheques.add(New Printer_Builder__c(status__c = 'pending', cheque_printer__c = cp.ID));}

    public void addrow() {
        cheques.add(new Printer_Builder__c(status__c = 'pending', cheque_printer__c = cp.ID));}
            
    public void removerow(){
        Integer i = cheques.size();
        cheques.remove(i-1);}
            
    public PageReference save() {
        insert cheques;
        return new PageReference('/'+cp.id); 
        }
        }



        Test.SetCurrentPageReference(New PageReference('Page.SelectCheques'));
        ApexPages.CurrentPage().GetParameters().Put('id', cp.ID);
        MultiChequeController controller = new MultiChequeController(ApexPages.CurrentPage.StandardController);
        System.CurrentPageReference().getParameters().put('id', cp.ID);
        controller.cheques.cheque_builder__c = ch.ID;
        controller.addRow();
        controller.removeRow();
        controller.save();

 

Hi all,

 

I've got a really odd situation occuring right now. One of my custom object is not allowing reports to be made (Custom Reports doesn't have that object in there, while it has every other one)

 

I have checked deployed, and allow reports - but it still isn't there.

 

Thanks!

Hi everyone,

 

I'm having trouble with finding the correct way to add related to information to an event being created in a trigger.

 

Does anyone know how to go about doing this?

 

The idea is book an appointment, when the appointment is booked, an event is created that relates to that appointment, I'm just unaware of how to do it.

 

Thanks!

Hi, so I'm experimenting with SFDC right now - and one thing I'd like is to have a PDF Catalog.

 

As in, I have a Customers tab, with First Names, Last Names, etc.

 

I'd like a page that loops through every Customer and spits them out into a "renderAs" PDF.

 

So a giant PDF Catalog of all customers.

 

Does anyone have an idea on how to go about doing this?

 

Thanks,

 

Miller91

Hi all,

 

I've got a really odd situation occuring right now. One of my custom object is not allowing reports to be made (Custom Reports doesn't have that object in there, while it has every other one)

 

I have checked deployed, and allow reports - but it still isn't there.

 

Thanks!