1

This is my js code:

var fields = {'OwnerId': user,'CreatedById': user,'WhoId': this.doctorName ,'StartDateTime':this.startDate, 'EndDateTime':this.endDate, 'Departments__c': this.depName, 'Doctor_Name__c': this.doctorName};
var objRecordInput = {'apiName' : 'Event', fields};
// LDS method to create record.
createRecord(objRecordInput).then(response => {
    alert('Event created with Id: ' +response.id);
}).catch(error => {
    alert('Error: ' +JSON.stringify(error));
});

I am getting this error:

Error: {"status":400,"body":{"message":"Object Event is not supported in UI API","statusCode":400,"errorCode":"INVALID_TYPE"},"headers":{}}

I have tried using lightning-record-form earlier. I got this same error. That's why I created my own UI, but that is also not working.

Henry Ecker
  • 34,399
  • 18
  • 41
  • 57

1 Answers1

0

You can check list of supported obejcts for createRecord in this All Supported Objects documentation.

As you can mention, Event object is not listed here.

You'll need to create custom static Apex method and call in imperatively from your js of lwc component, in order to create Event from lwc.