sorry for almost duplicate - but I have not enough reputation yet to comment on: Lightning/Aura components: aura attribute default sobjectType gives error in managedpackage
I am having the same issue with Standard Objects:
<aura:component >
<aura:attribute name="acc" type="Account" default="{'sObjectType':'Account', 'Name':'Account123'}"/>
</aura:component>
Trying to save, I get
"Failed to save undefined: Unable to read SObject: Source"
To my understanding of the documentation, I do not need any namespace for Standard Objects. I tried all combinations nonetheless to no avail.
Tried several standard Objects as well. All produce the same error with exception of sObjectType Event. The following can be saved but does not work:
<aura:component >
<aura:attribute
name="demo"
type="Event"
default="{'sObjectType':'Event',
'Subject':'Account123',
'WhoId':'00300000121aAAB'}"/>
{!v.demo.WhoId}
</aura:component>
<aura:attribute name="contact" type="contact" default="{'sObjectType':'Contact'}"/>
the type will be saved as szDev.contact - which makes sense.<aura:attribute name="contact" type="szDev.Contact" />
is accepted<aura:attribute name="contact" type="c.Contact" />
is (c is standard namespace, right?) accepted (and translated to szDev.Contact) But anything.Contact is accepted as type. Whereas anything.C2ontact throws an error: unknown type It is is still the question how to write{'sObjectType':'Contact'}
I tried c.Contact, c__Contact, szDev__Contact, szDev.Contact...force.hasSObjectName
andforce:hasSObjectId
that you might find helpful. They're new as of W16.