Custom table created with name 'picklist_item' with 'item_id' column as primary key, in one of the admin controller action, collection object for 'picklist' table has been created and called getIdFieldName() but it is returning NULL, I am expecting it should return the primary key table column name.
1 Answer
You should initialize the property $_idFieldName
with the value of the table primary key in the collection class associated with your table:
<Vendor>\<Module>\Model\ResourceModel\<ModelName>\Collection.php
:
protected $_idFieldName = 'item_id';
See original answer to a similar question: https://magento.stackexchange.com/a/145363/31483