1

Currently I have the following as a javascript list button that allows the user to selected records:

{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')}
var selectedRecords = {!GETRECORDIDS( $ObjectType.OrderItem )};
sforce.connection.deleteIds(selectedRecords);
navigateToUrl(window.location.href);

I need to replace this button so that it works in lightning.

I am not sure what the best approach would be, since OrderItem does not support list controllers and the default Edit All and Add products are being used by users.

I tried a flow but I cannot get the selected records. Is anyone able to suggest an approach to get the selected records to pass into the a flow?

  • For converting Javascript button to Lightning Actions, please follow the trailhead module trailhead.salesforce.com/en/content/learn/modules/…. I could not understand what do you mean by "orderitem" does not support list controller. Please explain. – Prolay Chaudhury Jun 2 at 14:46
  • If I try to put the orderitem (order products) into a recordSetVar it tells me: order item does not support list controllers – KarenM Jun 2 at 14:57
  • Here is the solution, salesforce.stackexchange.com/questions/70128/… – Prolay Chaudhury Jun 2 at 16:04
  • I figured out a non programmatic way to do this. I created a checkbox field on the orderitem object. When the user is editing all the records, they can check the ones they don't want and save. This launches process builder, on update and calls a flow. Any checked records are then deleted by the flow. This works in both lightning and classic and streamlines the process for my users. – KarenM Jun 2 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.