From 695dc2eb426e841506c3b17deb5f08ce2bbd1d41 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 19 Apr 2024 09:30:49 +0300 Subject: [PATCH] record service create: keep new --- application/Espo/Core/Record/Service.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index 2091f432a4..73ff156ef7 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -830,9 +830,16 @@ class Service implements Crud, /** @noinspection PhpDeprecationInspection */ $this->beforeCreateEntity($entity, $data); - $this->entityManager->saveEntity($entity, [SaveOption::API => true]); + $this->entityManager->saveEntity($entity, [ + SaveOption::API => true, + SaveOption::KEEP_NEW => true, + ]); $this->getRecordHookManager()->processAfterCreate($entity, $params); + + $entity->setAsNotNew(); + $entity->updateFetchedValues(); + /** @noinspection PhpDeprecationInspection */ $this->afterCreateEntity($entity, $data); /** @noinspection PhpDeprecationInspection */