How to delete the Opportunityline items those which are selected from the list of records. On the VF page , all the products should be displayed and when i select the checkbox then all the selected line items should be deleted related to an opportunity.
Hi Prema, You can get the list of ID of all checked rows then query to get all selected OpportunityLineItem sobjects (using 'List<OpportunityLineItem> list=[select id from OpportunityLineItem where Id IN : listOfSelectedIds'), run 'delete list' to delete all the objects.
Hello friends thanks for your reply i was able to figure it out on my own. If possible could you please let me know how can i update all the records of products when i click on Selected products.
Hi Prema, Once you have the list of records selected, you can directly loop over them, update their desired fields and use update command to update records. for(OpportunityLineItem opp:listToBeUpdated){ //update the desired fields } update listToOfUpdated;
No, I dont want any specific field to select it and get it in the list and finally update. I want it on the VF page but I am thinking how it would be possible to update the selected record on vf page. with maybe 3-4fields of every products it should be showing over vf page and there would be inline editing so that i can edit it and save it
You can get the list of ID of all checked rows then query to get all selected OpportunityLineItem sobjects (using 'List<OpportunityLineItem> list=[select id from OpportunityLineItem where Id IN : listOfSelectedIds'), run 'delete list' to delete all the objects.
Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts
Here is the code:
Mark it as solved if it does help you
Once you have the list of records selected, you can directly loop over them, update their desired fields and use update command to update records.
for(OpportunityLineItem opp:listToBeUpdated){
//update the desired fields
}
update listToOfUpdated;
Shubham Nandwana.
AppPerfect Corp.
salesforce@appperfect.com
408-252-4100
http://www.appperfect.com/services/salesforce/
Salesforce Development & Operations Experts