I m trying to update a datetime field from VF page using remoteObjets and I am getting this error:

err: Error: Last Viewed Timestamp: value not of required type: 2019-11-20T11:00:56.373Z

This is my relevant code:

var myDate = new Date().toISOString();
var record = new $M.Form_Details__c({Id:'{!myID}',Last_Viewed_Timestamp__c:myDate

What should be the right datetime format for the update?

1 Answer 1


It should just be a normal Date:

var rightNow = new Date();
var record = new $M.Form_Details__c({Id='{!myId}',Last_Viewed_Timestamp__c:rightNow});

The Remote Objects framework automatically converts the value to the correct type for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .