0

I have a custom component, in which I have FullCalendar. I'm trying to open the event creation page on dayClick event. But I'm getting below error:

Uncaught TypeError: Cannot read properties of undefined (reading 'setParams')

I am launching this custom component from Tab, on click of tab it opens fullCalendar's calendar. then on click I'm trying to create event.

I'm following all the steps mentioned here

dayClick :function(date, jsEvent, view) {
                console.log('>>> Day clicked... ');
                var datelist = date.format().toString().split('-');
                
                var datetime = new Date(datelist[0],parseInt(datelist[1])-1,parseInt(datelist[2])+1,0,0,0,0);
                console.log('>>> datetime... '+datetime);
                var createRecordEvent = $A.get("e.force:createRecord");
                console.log('>>> createRecordEvent... '+createRecordEvent);
                createRecordEvent.setParams({
                    "entityApiName": "Event",
                    "defaultFieldValues": {
                        'StartDateTime' :  datetime
                        
                    }
                });
                createRecordEvent.fire();
                
                
            },

In console log I'm seeing

createRecordEvent... undefined

1 Answer 1

1

force:createRecord and other such events are only handled in Lightning Experience and in the Mobile App. It will not function in a standalone Lightning App. Try adding the component to a Lightning Tab, and it should work.

You must log in to answer this question.

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