[SalesForce] force:inputField erroring out. Aura.loadComponent(): Failed to initialize application

   <aura:attribute name="cObj" access="global" type="Case" default="{'sObjectType':'Case'}"/>

                        <force:inputField aura:id="reqType" value="{!v.cObj.Type}"></force:inputField>

I get this error when loading this app with this component.

Aura.loadComponent(): Failed to initialize application.

Deleting the force:inputfield makes the page load properly.

Confused about why this doesn't seem to work at all for me. Doesn't matter what field I tried. Read the api and done other research, seeing if i'm missing some syntax or something obvious and couldn't find the issue.

Any help would be appreciated.

Best Answer

So, the issue is not the spacing. JSON doesn't care about spacing.

The issue is that you have used sObjectType rather than sobjectType

Change

default="{ 'sObjectType': 'Case' }"

To:

default="{ 'sobjectType': 'Case' }"

Notice the capitalization change?

Related Topic