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 “main_table.id”.

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

https://magento.stackexchange.com/questions/109835/unknown-columns-error-when-executing-a-mass-action/109866

 

Leave a Reply

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