Entity id availability in Custom Field
For getting the node ID you need to first save the node. For eg:

$node = Node::create([
      'type' =&gt; 'my_content_type',
      'title' =&gt; 'My Title',
      'uid' =&gt; \Drupal::currentUser()-&gt;id(),
      'status' =&gt; 1
]);
$node-&gt;save();
    :
    :

$id = $node-&gt;id();
$year = date("Y", $date);
// default format: 'SWAN%s%08dIMOV'
$format = $this-&gt;getSetting('format');
$node-&gt;field_custom-&gt;value = sprintf($format, $year, $id);
$node-&gt;save();