Based on Robert Scheitlin, GISP's answer, I have been trying to set a date attribute programmatically using the following expression:
evt<SPAN class="punctuation token">.</SPAN>adds<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>eventdate <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Date</SPAN><SPAN class="punctuation token">(</SPAN>Date<SPAN class="punctuation token">.</SPAN><SPAN class="token function">now</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
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<SPAN class="punctuation token">.</SPAN>adds<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>attributes<SPAN class="punctuation token">.</SPAN>description <SPAN class="operator token">=</SPAN> <SPAN class="string token">"test"</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
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