This topic is locked

rest api - default datetime

6/23/2023 9:30:54 AM
PHPRunner General questions
C
chanpeter88 author

datetime field is default to current datetime. using web to add, the datetime field is autofilled with datetime but
using rest api to insert, the datetime is empty.
pls advise.

Sergey Kornilov admin 6/23/2023

Default values are only meant to work in interactive mode, they are used to prepopulate input controls.
In your scenario you need to use code in BeforeAdd event:
$values["DateField"] = now();