Magento 2 – Custom Admin Mass Action Controller Fails to Filter Collection

I was recently creating a custom admin mass action controller for a UI component listing. The controller was throwing an exception when it was setting the filter on the collection. It turned out I had two things setup incorrectly because the custom table I was using for this mass action has a primary key id name that is different than “id”. I needed to┬ádefine the “$_idFieldName” in my ResourceModel Collection. See the StackExchange post for more information. I also needed to make sure the UI component datasource was configured correctly. The “primaryFieldName” configuration needs to be “main_table.<idfieldname>” and not “”.

StackExchange post about filtering on a mass action and the “$_idFieldName” is not set.


Leave a Reply

Your email address will not be published. Required fields are marked *