+ Start a Discussion
Shubham Agrawal 13Shubham Agrawal 13 

how to navigate record crate page of lightning experience from lightning component?

Hi All,
I am new to Salesforce Lightning, Please help me to do this requirement.
I tried by using  '$A.get( 'e.force:createRecord' )' this standard event but its not working.
Thanks in advance...
Arun ParmarArun Parmar
var createAcountContactEvent = $A.get("e.force:createRecord");
"entityApiName": "Contact",
"defaultFieldValues": {
'Phone' : '123467890',
'AccountId' : '001***********' }

Try like this, it will work.
Shubham Agrawal 13Shubham Agrawal 13
Hi Arun,
I have already tried with the same type of code you suggested before posting this question here, It's not working.
Actually I am calling my lightnin component from VF as below : 
    function redirectTolightning(){
    $Lightning.use("c:TestLightning_App", function() {
                               function(cmp) {
                                   console.log('>>>>> App is hosted');

Then i wrote 'force:createRecord' event (with proper syntax as you have witten) in Lightning Component (i.e Lightning Javascript Controller), But its not working. 
I am niether getting any error nor redirected to standard record create page.
Is there any other solution to this?? While navigating i have to populate some field values also...
Please help...
Arun ParmarArun Parmar
Hi Shubham,
please double check you are using 
$Lightning.createComponent("c:c:TestLightning_Comp", )

please remove on c: they came twice in script.
Shubham Agrawal 13Shubham Agrawal 13
No Arun, that was typing mistake when i posted my code here.
In the org there is only one 'c' like this - $Lightning.createComponent("c:TestLightning_Comp", )
Arun ParmarArun Parmar
Hi Shubham ,
you are doing fine, just check weather you included <apex:includeLightning/> tag.