Unable to implement "force:inputField" or "force:outputField" markup on lightning components
Last updated 2022-10-04 ·Reference W-2496267 ·Reported By 118 users
Summary
When implementing "force:inputField" or "force:outputField" markup on lightning components and preview it on a visualforce page you will get the following error:
"Assertion Failed!: Abstract component without provider def cannot be instantiated : markup://force:outputField : undefined.”
Repro
1. Create a Lightning component Application
2. Create an Apex Controller that enables Aura
3.Create a Lightning Component code with <force:inputField aura:id="UserName" value="{!v.user.Name}" /> or
<force:outputField aura:id="UserId" value="{!v.user.Id}" />
4. Create a visualforce page to load the aura components inside
5. Error shows up at the bottom of the page
1. Lightning APP dependency:
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="c:jediLightningComponent"/>
</aura:application>
2. Apex to enable Aura:
public with sharing class JediLight {
@AuraEnabled
public static User getUser() {
return [select Id, Name from User Limit 1];
}
}
3. Lightning Component Code:
<aura:component controller="JediLight" implements="flexipage:availableForAllPageTypes,force:appHostable">
<aura:attribute name="user" type="User" default="{ 'sobjectType' : 'User' }" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"></aura:handler>
<force:inputField aura:id="UserName" value="{!v.user.Name}" />
<force:outputField aura:id="UserId" value="{!v.user.Id}" />
</aura:component>
4. Visualforce Page:
<apex:page >
<apex:includeLightning />
This is a test.
<div id="lightning" />
<script>
$Lightning.use("c:jediApp", function() {
$Lightning.createComponent("c:jediLightningComponent",
{},
"lightning",
function(cmp) {
console.log("Component created!");
console.log(cmp);
});
});
</script>
</apex:page>
Workaround
None Available
Reported By (118)
































































Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.