I'm trying to fill <aura:attribute name="selectedQuotation" type="salesTool.Quotation__c" /> in any way that could works

Filling it with default value compile (means i can save the file)

default="{ 'sobjectType': 'salesTool__Quotation__c',
'Name': 'Test',

But a "Uncaught Error: ComponentDef Config required for registration" Error is raised in browser logs at runtime. The folloing demonstration example works well for me :

<aura:attribute name="newExpense" type="salesTool.Expense__c"
default="{ 'sobjectType': 'salesTool__Expense__c',
'Name': '',
'salesTool__Amount__c': 0,
'salesTool__Client__c': '',
'salesTool__Date__c': '',
'salesTool__Reimbursed__c': false

But my case is different in a way i use lookupFields and not only literals.

Filling it with an instance of myCustomObject through application event result in an other error. As it seems my aura:attribute is empty at the initialisation of the component, the variable last in a aura source code is null and cause error.

 if (value.auraType === "Component" || !value.isLiteral()) {
            var last = component.lastRenderedValue;
            if (last !== value) {
                var referenceNode = **last**.getReferenceNode();

If somebody have some better experience of lightning, I would appreciate some help ;)

  • Hello, DemoMan, can you add some more details on the bigger picture of what you are trying to do with last.getReferenceNode()? Perhaps one of us can recommend an alternative approach.
    – Marty C.
    Nov 8 '14 at 13:04

You can set a the value of a Lookup field with the Id of the record it references.

For example, if you have a Contact object you can specify a default for the Account lookup, by specifying an Id string for the AccountId field.

<aura:attribute name="newContact" type="Contact"
    default="{ 'sobjectType': 'Contact',
               'LastName': 'Smith',
               'AccountId': '001i000002zxpz1' 

You could also leave it blank and then set it in your JavaScript before calling to your Apex controller.

<aura:attribute name="newContact" type="Contact"
    default="{ 'sobjectType': 'Contact',
               'LastName': 'Smith',
               'AccountId': '' 

And, prior to enqueueing the action set the value explicitly.

var con = component.get("v.newContact");
con.AccountId = '001i000002zxpz1';
    con: con

Or, you could leave it blank altogether and set it in your Apex controller:

public static Contact createContact(Contact con) {
    con.AccountId = '001i000002zxpz1';
    insert con;

    return con;

DemoMan, you can set Lookup or Master-Detail field values in the exact same way you would set other sObject fields in Lightning, using component.set(). You can actually create a custom component, and pass the Lookup field as a value to it, in the following fashion:

<salesTool:inputLookupContact value="{!v.quote.salesTool__Contact__c}"/>

You can take a look at this oneContact.app demo I created using a Contact object as the focal point, demonstrating how the Contact.AccountId field is manipulated using a custom ccmt:inputLookupAccount component.


Sorry guys it seems my "Uncaught Error: ComponentDef Config required for registration" was due to a silly error :

Writing this :


in a component leads to an error when you try to setup the "default" attibute of the aura:attribute element. whatever you set as attribute value.

<aura:attribute name="selectedQuotation" type="salesTool.Quotation__c" default="{ 'sobjectType': 'salesTool__Quotation__c',...}" />

Changing the path {!v.selectedQuotation} to a valid field like : {!v.selectedQuotation.Name} solved the issue

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .