function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Angel ZAngel Z 

Visualforce page : [Cannot read property 'setParams' of undefined]

Hi all,

I want to invoke a lightning component from a list button.

Everything works fine except if I use "e.force:createRecord".

Here's the error message: 
This page has an error. You might just need to refresh it. Action failed: c:leadCollector$controller$createRecordHelper [Cannot read property 'setParams' of undefined] Failing descriptor: {c:leadCollector$controller$createRecordHelper}

Any piece of advice would be greatly appreciated.
Thanks
Best Answer chosen by Angel Z
Khan AnasKhan Anas (Salesforce Developers) 

Hi Zaykov,

Greetings to you!

You cannot use force:createRecord event in visualforce. According to Salesforce doc (https://developer.salesforce.com/docs/component-library/bundle/force:createRecord/documentation): 

This event is handled by the one.app container. It’s supported in Lightning Experience, the Salesforce app, and Lightning communities. This event presents a standard page to create a record. That is, it doesn’t respect overrides on the object’s create action.

Please refer to the below link which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/124405/lightning-issue-while-calling-createrecord-event-component

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas