We have multiple JavaScript buttons that follow this pattern where the set of checked records in a list view are first checked and then a server side operation is applied to them:
{!REQUIRESCRIPT('/soap/ajax/25.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/25.0/apex.js')}
var ids = {!GETRECORDIDS($ObjectType.Claim__c)};
if (ids.length > 0) {
var result = sforce.apex.execute('cve.ClaimActions', 'updateBenefitSummary', {claimIds: ids});
if ('success' == result) {
// See the changes
window.location.reload();
} else {
// See the error message
alert(result);
}
} else {
alert('Select at least one Claim first using the checkboxes');
}
Such buttons are no longer rendered in Lightning Experience and so require rework if "Lightning Ready" status is to be maintained.
My reading of this Trailhead Use Quick Actions, Custom Buttons, or Apex is that to create a Lightning Experience alternative, somewhat counter-intuitively a Visualforce page is the only solution.
Two related questions:
- Is Visualforce the only way to go?
- The Trailhead example does not illustrate how Visualforce can obtain the selected record Ids (some equivalent of
GETRECORDIDS
) from the Lightning list view. How is that done?(Based on some Googling, I'm starting to suspect that there is no solution...)