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

list view selected ids to visualforce page
I am working on creating list view button which can pass selected id's to visualforce page but some how vf page is unable to catch those selected id's.
In classis I used javascript buttons but can anyone help me out how to do this in lightning. My code is below.
Apex Class:
In classis I used javascript buttons but can anyone help me out how to do this in lightning. My code is below.
Apex Class:
public with sharing class PaymentSummaryController { public boolean InError {get;set;} public decimal TotalAmount {get;set;} public decimal TotalAppliedAmount {get;set;} public integer TotalItems {get;set;} public List<String> selectedIds {get;set;} public PaymentSummaryController(ApexPages.StandardSetController controller) { InError=false; controller.setPageSize(1000); String str = ApexPages.currentPage().getParameters().get('selectedIds'); if(str !=null) selectedIds = String.escapeSingleQuotes(str).split(','); if (selectedIds==null || selectedIds.size()==0) { ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please select at least one record.'); ApexPages.addMessage(myMsg); InError=true; } else { TotalAmount=0; TotalAppliedAmount=0; TotalItems=0; for (EXECED_Payment__c p : [select id,Amount__c,Total_Applied_Amount__c from EXECED_Payment__c where id in: selectedIds]){ if (p.Amount__c!=null) TotalAmount+=p.Amount__c; if (p.Total_Applied_Amount__c!=null) TotalAppliedAmount+=p.Total_Applied_Amount__c; TotalItems++; } } } }Visualforce page:
<apex:page standardController="EXECED_Payment__c" sidebar="false" showHeader="false" extensions="PaymentSummaryController" recordSetVar="payments" lightningStylesheets="true"> <apex:form > <apex:pagemessages /> <apex:outputPanel rendered="{!inError}"> <apex:commandButton action="{!Cancel}" value="Cancel"/> </apex:outputPanel> <apex:outputpanel rendered="{!not(InError)}"> <br/> <table> <tr> <td><apex:outputtext value="Number of payments selected:"/></td> <td><apex:outputtext style="font-weight:bold;" value="{!TotalItems}"/></td> </tr> <tr> <td><apex:outputtext value="Total Amount:"/></td> <td><apex:outputtext style="font-weight:bold;" value="{!TotalAmount}"/></td> </tr> <tr> <td><apex:outputtext value="Total Applied Amount:"/></td> <td><apex:outputtext style="font-weight:bold;" value="{!TotalAppliedAmount}"/></td> </tr> </table> <!-- <br/><br/> <apex:commandButton action="{!Cancel}" value="Return"/> --> </apex:outputpanel> </apex:form> </apex:page>
You can render your list using a lightning data table and use event to capture the id and pass to do your logic. Eg: Below shows a List of account below. Modify your code accordingly.