How do I get the last "ID" (row) created after using the "channel_form_submit_entry_end" hook? Can the hook send me the "ID"? EE5

  • Are you looking for the ID of the entry which was just created by the channel form submission? Dec 4, 2018 at 17:40
  • Yes. The ID of the entry created by the channel form submission. Dec 4, 2018 at 19:35

2 Answers 2


At the end of hook "channel_form_submit_entry_end" it is using the Channel Form Class so $obj->entry['entry_id'] a class property which is not available.

Good news is you can use the method $obj->entry('entry_id') to retrieve the entry which is one of available methods from Channel_form_lib


If you do a dump of the argument which that hooks accepts, you'll see it should contains the entry_id. I can't recall exactly what the structure looks like (it might just be $obj->entry_id or $obj['entry_id']), but do this to find out:

function channel_form_submit_entry_end($obj)
  • I used my_function($obj){ exit(var_dump($obj)); } But the entry_id is not there or set Dec 5, 2018 at 20:32
  • Should be $obj->entry['entry_id'] ... is the submission completing successfully (showing up in the database)? Dec 6, 2018 at 13:17
  • Yes. It is being created. Dec 6, 2018 at 17:09
  • Fatal error: Uncaught Error: Cannot use object of type EllisLab\ExpressionEngine\Model\Channel\ChannelEntry this is the error I get when I try to call $ojb->entry['entry_id'] Dec 11, 2018 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.