Storing entry ID as a custom field

I want a single line text field to dynamically populate with the current entry ID. I’m currently trying to do this using a gform_after_submission hook…

I have the following code in functions.php:

add_action( 'gform_after_submission', 'save_entry_id', 10, 2 );
function save_entry_id($entry, $form){
    update_post_meta($entry['post_id'], 'gfentryid', $entry['id']);
}

In the form admin field edit, I have 'Allow field to be populated dynamically" ticked with ‘gfentryid’ entered as the Parameter Name.

Can anyone tell me why it’s not working?