• vjw
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I have a custom button on a contact list view that's connected to a VF page. All I want to do on the VF page is run some DML to update the selected contacts, then go back to the list view, as long as at least one contact was selected. If no contacts were selected, I want to display an err message. When I run the page, whether or not I've selected any contacts, I get this err message: "Unknown method 'ContactBarcodeCreated.updateBarcodeCreated()'" Thanks for any help you can provide.

VF page tag:


Apex:
public class ContactBarcodeCreated {
public sObject[] objs { get; private set; }
public boolean hasSelection { get; private set; }


public pageReference updateBarcodeCreated(ApexPages.StandardSetController controller ){
objs = controller.getSelected();
hasSelection = !objs.isEmpty();
if (hasSelection) {

Contact[] cons = new contact[0];
for (sObject c : objs){
cons.add(new Contact(
id=c.id,
Barcode_Card_Created__c = true,
Barcode_Card_Created_Date__c = system.today()
));
}
update cons;

// go back
string url = ApexPages.currentPage().getParameters().get('retURL');
pageReference prevPage = new PageReference((url != null) ? url : '/006');
prevPage.setRedirect(true);
return prevPage;
}
else {
return null;
}

}


}
  • July 23, 2009
  • Like
  • 0
I have a custom button on a contact list view that's connected to a VF page. All I want to do on the VF page is run some DML to update the selected contacts, then go back to the list view, as long as at least one contact was selected. If no contacts were selected, I want to display an err message. When I run the page, whether or not I've selected any contacts, I get this err message: "Unknown method 'ContactBarcodeCreated.updateBarcodeCreated()'" Thanks for any help you can provide.

VF page tag:


Apex:
public class ContactBarcodeCreated {
public sObject[] objs { get; private set; }
public boolean hasSelection { get; private set; }


public pageReference updateBarcodeCreated(ApexPages.StandardSetController controller ){
objs = controller.getSelected();
hasSelection = !objs.isEmpty();
if (hasSelection) {

Contact[] cons = new contact[0];
for (sObject c : objs){
cons.add(new Contact(
id=c.id,
Barcode_Card_Created__c = true,
Barcode_Card_Created_Date__c = system.today()
));
}
update cons;

// go back
string url = ApexPages.currentPage().getParameters().get('retURL');
pageReference prevPage = new PageReference((url != null) ? url : '/006');
prevPage.setRedirect(true);
return prevPage;
}
else {
return null;
}

}


}
  • July 23, 2009
  • Like
  • 0