You need to sign in to do that
Don't have an account?
Help with Test Code
Hi All,
Looking for some help creating a test method for the code below. New to Apex and running in to errors installing the Force.com IDE so any help is much appreciated.
public with sharing class massupdatefield{
public List<Contact> contacts{get; set;}
public list<selectoption> options{Get; set;}
public string selected{get; set;}
String saveUrl = ApexPages.currentPage().getParameters().get('retURL');
public massupdatefield(apexpages.standardsetcontroller ssc){
contacts = (list<contact>)ssc.getSelected();
Schema.DescribeFieldResult FR = Contact.Rep_Call_List__c.getDescribe();
List<Schema.PicklistEntry> PL = FR.getPicklistValues();
options = new list<selectoption>();
for(schema.PickListEntry p:PL){
options.add(new selectoption(p.getLabel(), p.getvalue()));
}
}
public pagereference updatecontacts(){
for(Contact c:contacts){
c.Rep_Call_List__c = selected;
}
update contacts;
return new pagereference(saveurl);
}
}
Hi,
This is the code which you need, hopefully it will cover the code coverage.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Getting a failure error:
Save error: Constructor not defined: [massupdatefield].<Constructor>(ApexPages.StandardController) massupdatefield.cls
Try this :
Hope this will work.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Please mark it as a solution if it resolved your problem.
Thanks
Ankit Arora
Blog | Facebook | Blog Page