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
jerrymoljerrymol 

Help with Including Lightning Component in a Visualforce Page

I am not sure what I am missing here which leads me to get some error when I include a lightning component in a visual force page.

Let me brief you my scenario:
I have created a lightning component which has some components in it like <ui:inputNumber> and <force:inputField>. I am using the force:inputField component to show a lookup field on a salesforce object. (Let's say case owner lookup). I have added this component in a lightning application and the component is working fine. When I preview the application, I can see it working.. I can select the user name or queue name on  the force:inputField.

Now when I add the same component in a visual force page (used <apex:includeLightning /> tag in VF page :kindly see the attached code) I am getting below exception:
'Something has gone wrong. Assertion Failed!: Abstract component without provider def cannot be instantiated : markup://force:inputField : undefined. Please try again. '
 Any idea?
Paul Allsopp 3Paul Allsopp 3
I don't see any attached code. But what that error is saying is there is no definition for that force:inputField, which is strange as you said it works when viewing in preview mode.

Change your force:inputField to apex:inputField and see if that works
jerrymoljerrymol
Hello, i cannot use apex:inputField in lightning components..
Here is the VF page which include the lightning componenr named testForceField

<apex:page>
    <apex:includeLightning />
    <div id="lightning" />
    <script>
        $Lightning.use("c:testForceFieldApp", function() {
            // Write a function that creates the component on the page
            $Lightning.createComponent("c:testForceField",
                {},
                 "lightning",
                 function(cmp) {
                 // do some stuff
                 }
            );             
         });
    </script>
</apex:page>