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
Pradeep BandarpalliPradeep Bandarpalli 

Values are not getting passed from component to client controller when attribute type is sObject "Event"

HI,
I have a requirement to create a new Event from a custom lightning component. the code i used is below

<aura:component >
 <aura:attribute name="newEvent" type="Event"
                    default="{ 'sobjectType': 'Event',
                             'Subject':'',
                             'Description':''
                             }"/>
<div>
<ui:inputText aura:id="subject" class="slds-input" value="{!v.newEvent.Subject}"
                                                      placeholder="Enter Subject"/>
<ui:inputTextArea aura:id="comment" class="slds-input" value="{!v.newEvent.Description}" 
                                                          placeholder="provide your comments"/>
<button class="slds-button slds-button--neutral" onclick="{!c.cancel}">Cancel</button>
<button class="slds-button slds-button--neutral slds-button--brand" onclick="{!c.save}">Save</button>
</div>
</aura:component>

---controller----
({
    save : function(component) {
        var event = component.get("v.newEvent");
        window.alert(event);        //getting undefined
}
})

I am getting values as undefined. In case if I use sObject as Task instead of an Event, this is working Good and values passed are getting displayed. Is this due to the confusion between lightning events and sObject Event or anything ? Any help here is very much appreciated.
Thank You!
Jai ChaturvediJai Chaturvedi
Hi,

Use  type="Object". Some objects are not directly supported I think.
 
Pradeep BandarpalliPradeep Bandarpalli
Hi Jai, I have tried with the Object, it didnt worked.