How can I get the list of selected IDs (Select All included)?

Hello! I need to create a custom action for a custom module’s on List View.

I put the code

    $this->lv->actionsMenuExtraItems[] = $this->myFunction();

inside preDisplay function and I made my function. In the controller I did $_REQUEST[ā€˜uid’] to get the id’s of the records but I noticed I can’t get all the records from ā€œall selectedā€ checkbox.

How can I get the list of selected IDs (Select All included) from my JS code?

Thanks.

I see what you mean the JavaScript doesn’t send the id’s of the entire list but what it does send is a parameter $_REQUEST[ā€œselect_entire_listā€] if you select all it’s set to 1 other wise 0 so you can use this to determine if all records have been selected.

You can then use this $Bean->get_full_list(’’,ā€œname = ā€˜Something’ AND choix_loc = ā€˜SomethingElseā€™ā€); to get all the records and do what ever you need to do.

https://developer.sugarcrm.com/2012/11/12/getting-a-set-of-beans-by-conditions-without-sql

This may also be helpful for what you are trying to do.

https://developer.sugarcrm.com/2010/11/22/howto-adding-your-own-listview-action-items