You need to sign in to do that
Don't have an account?
![Kalpesh Vyas 14 Kalpesh Vyas 14](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
force:createRecord is not working
Hello,
I am getting below error while trying to use force:createRecord in one of my lightning component
![User-added image](/forums/servlet/rtaImage?eid=9060G000000MOOz&feoid=Body&refid=0EM0G000000J330)
Here is little code excerpt where xQualification_Comment__c is custom object.
Below is js for component:
![User-added image](/forums/servlet/rtaImage?eid=9060G000000MOOz&feoid=Body&refid=0EM0G000000J335)
Here is component
![User-added image](/forums/servlet/rtaImage?eid=9060G000000MOOz&feoid=Body&refid=0EM0G000000J33A)
I am getting below error while trying to use force:createRecord in one of my lightning component
Here is little code excerpt where xQualification_Comment__c is custom object.
Below is js for component:
Here is component
All Answers
I seen this standard behavior takes me to object which is recently created after I click on save, is it something possible or avaiable to prevent this behavior of redirection and stay on the detail page (the page which opened this window) after save?
force:createRecord event is not working when I click the "Create Record" button. Please find the code below:
CreateRecordEvent.cmp:
<aura:component implements="flexiPage:availableforAllPagetypes,force:appHostable">
<lightning:button label="Create Record" value="{!c.CreateRecord}" variant="brand"/>
</aura:component>
CreateRecordEventController.js:
({
CreateRecord : function(component, event, helper) {
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
'entityApiName':'Account',
});
createRecordEvent.fire();
}
})
Please help.
can we pass dynamic values instead of hard coded values in default fields like below,
"defaultFieldValues": {
Opportunity__c' : OppID.AccountId
}
Any one please suggest if you have faced this so far.
Thanks,
Sravan