Can't read date_entered

Hello,

After the second save bean I can’t get the field:

        $bean= BeanFactory::newBean('my_project');
        $bean->name="test";
        $bean->save();
        .......
        $bean->name="test1";
        $bean->save();
        $created_date=$incident->date_entered;

then $created_date is null

Even if I do before that $bean= BeanFactory::newBean(‘my_project’, $bean->id);
$created_date will still be null

Are you creating this inside a logic hook?

if true. Then I will recommend to use other word from instead of $bean as that is already used by the current bean.

No, it’s part of a custom API

Got it. Sorry that’s not my expertise. Please check these links. Hope they can give you an idea on how to solve your issue:

https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/4306/how-to-set-date_modified-through-rest-api

Thanks for the answer, but there cases when trying to write down time are considered. I just want to read the already recorded time.
So far, only such a temporary solution: I create a variable where I write the time after the creation of the Bean and later read it