Programmatically node update while saving node
You can use hook_entity_presave

function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {

    if ($entity-&gt;getEntityTypeId()=='node'){
        $value="099545";
        $entity-&gt;set('name_field', $value);
    }
}