0

I need help with a controller extension to retrieve and update parent records from a list view. We have a child object called Patient_Session__c that has a lookup to parent called Patient_c and want to use a visualforce page to update the parent records in mass edit mode from a list view of the child records. Here's the extension I am using

public with sharing class updatePatientInfo {
    public Patient_Session__c pgn;
    public Patient__c patient; 
    public updatePatientInfo(ApexPages.StandardController controller) {
        this.pgn = (Patient_Session__c)controller.getRecord();
        this.patient = [SELECT Id,Name,Patient_Description__c,A_1__c,A_Frequency__c,B_1__c,B1_Frequency__c,B2_Frequency__c,C_1__c,C1_Frequency__c,C2_Frequency__c,D_1__c,D1_Frequency__c,D2_Frequency__c,X__c FROM Patient__c WHERE ID = :ApexPages.currentPage().getParameters().get('id')];
    }
    public PageReference saveRecord() {
            update patient;
    update pgn;  
        return null;
    }
 }

When I try to save the visualforce page I get this error

"Error: Unknown constructor 'updatePatientInfo.updatePatientInfo()"

I am new to apex so any help would be greatly appreciated

0

From your code:

public updatePatientInfo(ApexPages.StandardController controller)

and your error:

"Error: Unknown constructor 'updatePatientInfo.updatePatientInfo()"

I can say the following:

you don't have updatePatientInfo constructor that takes no arguments. Your only constructor needs 1 argument of type ApexPages.StandardController

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.