0

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
});
record.update(updateCallback);

What should be the right datetime format for the update?

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.