You need to sign in to do that
Don't have an account?
Surinder Singh 51
force:createrecord not working
JS Controller : method calling from Comp button.
Getting error : This page has an error. You might just need to refresh it. Action failed: c:getContactComp$controller$createContact [Cannot read property 'setParams' of undefined] Failing descriptor: {c:getContactComp$controller$createContact}
Requirmeent: on click of button, want to display create contact screen with default phone or any field.
createContact: function(component, event, helper){ // var createRecordEvent = $A.get('e.force:createRecord'); createRecordEvent.setParams({ 'entityApiName': 'Contact', "defaultFieldValues": { 'Phone' : '415-240-6590'} }); createRecordEvent.fire(); }
Getting error : This page has an error. You might just need to refresh it. Action failed: c:getContactComp$controller$createContact [Cannot read property 'setParams' of undefined] Failing descriptor: {c:getContactComp$controller$createContact}
Requirmeent: on click of button, want to display create contact screen with default phone or any field.
I too faced the same error, I mitigated the issue by navigating to the record-create form.
Please refer the link (https://developer.salesforce.com/docs/component-library/bundle/force:createRecord/documentation) for better insights.
All Answers
I too faced the same error, I mitigated the issue by navigating to the record-create form.
Please refer the link (https://developer.salesforce.com/docs/component-library/bundle/force:createRecord/documentation) for better insights.
Are you talking about lightning:navigate ? Does it means force:createrecord has bugs and not working for all ?
If possible can you please share your lines of code.... how to use record-create-form.
From my button click i tried to navigate to new component again, getting nothing :
var newEvent= $A.get("e.force:navigateToComponent");
newEvent.setParams({
componentDef: "RecordCreateEditForm",
componentAttributes: {
//Set you attributes here if required.
}
});