I'm declaring the following in my Visualforce page:
<apex:remoteObjects>
<apex:remoteObjectModel name="Contact" fields="FirstName,LastName,Id">
</apex:remoteObjectModel>
</apex:remoteObjects>
I'm then attempting to create a simple contact record with the following:
const data = {
FirstName: 'Clark',
LastName: 'Kent'
};
console.log({ data });
const contact = new SObjectModel.Contact(
data,
(error, results, event) => {
console.log({ error, results, event });
}
);
contact.create();
console.log({ contact });
When I load the page, I see the output of the two console logs, with the properties correctly set on the contact
object, but the callback function is never called and no record is created. No error occurs.
How can I use the remote object model to create contact (and later, other) records?