Can we create a record for Event object through lwc in Salesforce

0 votes

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.

Apr 1 in SalesForce by surbhi
• 3,810 points
186 views

1 answer to this question.

0 votes

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

https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_all_supported_objects.htm

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.

answered Apr 5 by CoolCoder
• 4,360 points

Related Questions In SalesForce

0 votes
0 answers

Can we create new Search Layout in Lightning SalesForce?

I am working on the Search Layout, ...READ MORE

Mar 4 in SalesForce by surbhi
• 3,810 points
67 views
0 votes
0 answers

Can i create a sql table populated with Salesforce objects?

does Salesforce offer a way to obtain ...READ MORE

Mar 4 in SalesForce by surbhi
• 3,810 points
56 views
0 votes
0 answers

Salesforce Test Class - System.NullPointerException: Attempt to de-reference a null object

Salesforce Test Class - Facing - System.NullPointerException: ...READ MORE

Mar 1 in SalesForce by surbhi
• 3,810 points
420 views
0 votes
1 answer

Salesforce Test Class - System.NullPointerException: Attempt to de-reference a null object

Because testAccount.account is never set, it is ...READ MORE

answered Mar 2 in SalesForce by surbhi
• 3,810 points
279 views
+2 votes
2 answers

Salesforce Interview questions

Here are some questions very important for ...READ MORE

answered Jan 11, 2019 in Career Counselling by Suresh
• 720 points
1,873 views
0 votes
1 answer

How to connect to salesforce from tableau?

Hi, follow these steps to connect to Salesforce: 1. ...READ MORE

answered Mar 25, 2019 in Tableau by Cherukuri
• 33,010 points
302 views
0 votes
1 answer

Power BI - Salesforce

Hi, Follow below steps: 1. Go to Data source. 2. ...READ MORE

answered Mar 25, 2019 in Power BI by Cherukuri
• 33,010 points
182 views
0 votes
1 answer

What is the best training for Salesforce ADM-201 Exam?

Hi @Vardhan, I took Edureka's Salesforce Training that covers all ...READ MORE

answered Jun 3, 2021 in Others by Jaya
• 140 points

edited Dec 22, 2021 by Soumya 216 views
0 votes
1 answer

How can we create salesforce developer account for salesforce essentials?

Developer.salesforce.com is where you can sign up ...READ MORE

answered Mar 3 in SalesForce by CoolCoder
• 4,360 points
72 views
0 votes
1 answer

how to create a custom login page in salesforce.com?

Here are a few things to consider: Is ...READ MORE

answered Apr 6 in SalesForce by CoolCoder
• 4,360 points
126 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP