How to know node/entity ID from a submit handler?
I would recommend not to use extra submit handlers on node forms. Forms are not the only way that you can create a node. Modules like Feeds, Migrate, etc can create nodes programatically. 

If it's a node, and you don't want to alter data that the node itself, implement hook_node_insert and you have access to the whole $node object!
$node-&gt;nid would be the node ID if you name your function's first argument as $node.

If you prefer an extra submit handlers, you can access node or entity that is being created/updated in $form (I can't remember the exact key name though). 

Install Devel module. Then, you can see what's in the $form array in your submit handler like this:

function mymodule_extra_submit_handler($form, &amp;$form_state) {
  dpm($form); // pretty-prints the entire form.
}


Usually $form['#node'] is the node object, so nid is $form['#node']-&gt;nid