You need to sign in to do that
Don't have an account?

How to delete mass record without using wrapper class in vf page.
Hello,
On vf page I wnat to delete multiple record on seletct checkbox using delte button. I have implemented using wrapper class but I don't want use wraper class.

----------------------Controller---------------------
public with sharing class SRC_ServiceCloudHomePage4 {
public List<product2> productlist{
get {
if (productlist== null) {
productlist= [select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where Battery_Type__c != 'Radio Battery'
];
}
return productlist;
}
set;
}
public List<Case> caseList{
get {
if (caseList == null) {
caseList=[select id, Owner.Name, CaseNumber, Description, Product_Code__c, Reason, Status, Origin, CreatedDate From Case ];
}
return caseList;
}
set;
}
public List<Observance_Managment__C > omlist{
get {
if (omlist== null) {
omlist=[select id, Name, Owner.Name, Status__C, Battery_Number__c, Within_Warranty__c, Observed_Problem__c, Description__c, Case__r.CaseNumber from Observance_Managment__c ];
}
return omlist;
}
set;
}
public product2 prData {get;set;}
public String paramprouctId{get;set;}
public Boolean displayPopUp {get;set;}
public PageReference showPopup() {
prData = [select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where id=:paramprouctId];
displaypopup = true;
return null;
}
public String productId{get;set;}
public product2 prData1{get;set;}
public void deleteRecord()
{
System.debug('before calling delete methode'+productId);
System.debug('************************'+productId);
// String productId= System.currentPageReference().getParameters().get('row_id');
prData1=new product2();
System.debug('prId'+productId);
prData1=[select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where id=:productId];
System.debug('prData'+prData1);
delete prData1;
}
}
On vf page I wnat to delete multiple record on seletct checkbox using delte button. I have implemented using wrapper class but I don't want use wraper class.
----------------------Controller---------------------
public with sharing class SRC_ServiceCloudHomePage4 {
public List<product2> productlist{
get {
if (productlist== null) {
productlist= [select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where Battery_Type__c != 'Radio Battery'
];
}
return productlist;
}
set;
}
public List<Case> caseList{
get {
if (caseList == null) {
caseList=[select id, Owner.Name, CaseNumber, Description, Product_Code__c, Reason, Status, Origin, CreatedDate From Case ];
}
return caseList;
}
set;
}
public List<Observance_Managment__C > omlist{
get {
if (omlist== null) {
omlist=[select id, Name, Owner.Name, Status__C, Battery_Number__c, Within_Warranty__c, Observed_Problem__c, Description__c, Case__r.CaseNumber from Observance_Managment__c ];
}
return omlist;
}
set;
}
public product2 prData {get;set;}
public String paramprouctId{get;set;}
public Boolean displayPopUp {get;set;}
public PageReference showPopup() {
prData = [select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where id=:paramprouctId];
displaypopup = true;
return null;
}
public String productId{get;set;}
public product2 prData1{get;set;}
public void deleteRecord()
{
System.debug('before calling delete methode'+productId);
System.debug('************************'+productId);
// String productId= System.currentPageReference().getParameters().get('row_id');
prData1=new product2();
System.debug('prId'+productId);
prData1=[select id, IsActive, Name, ProductCode, Battery_Type__c, Product_Image__c, Purchase_Date__c, Warranty__c, Description from Product2 where id=:productId];
System.debug('prData'+prData1);
delete prData1;
}
}
Refer this link:
https://www.cloudforce4u.com/2013/06/visualforce-page-component-for-mass.html
Hope this helps.
Below code can fulfill your requirements. Hope this will work for you.
Visualforce Page: Controller:
Please mark this as best answer if this solves your problem.
Thank you
Ajay Dubedi