Based on Robert Scheitlin, GISP's answer, I have been trying to set a date attribute programmatically using the following expression:
evt.adds[0].attributes.eventdate = new Date(Date.now());
This generates the following error: "Error: Unable to complete operation"
However, if I try to set the value of a text field it works fine, e.g.:
evt.adds[0].attributes.description = "test";
So I suppose the problem has to do with the field type. How can this be resolved?
Here is my entire code for reference. Thanks
Solved! Go to Solution.
Naci,
Try:
evt.adds[0].attributes.eventdate = new Date(Date.now()).getTime();
Naci,
What is the field type for your eventdate field?
Robert,
It is esriFieldTypeDate. Here is the full information of the field: "eventdate ( type: esriFieldTypeDate , alias: Date , editable: true , nullable: true , length: 8 )"
This is the service I am using: Layer: Wildfire Response Points (ID: 0)
Naci,
Try:
evt.adds[0].attributes.eventdate = new Date(Date.now()).getTime();
Awesome, thanks!