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
Puja Dev 6Puja Dev 6 

How to store Picklist and Lookup field from Lightning Component into Account Object...?

Hi
I have the following Lightning Component to save the record into Account Object.
It saves standard field (Acc Name, Description). But not Custom fields.

I want to add one picklist field and one lookup field on Component.

<!-- NewAccount -->
<aura:component implements="force:appHostable" controller="AccountController">
    <aura:attribute name="newAccount" type="Account" default="{ 'sobjectType': 'Account', 'Name': '', }"/>
    <div >
        <center>
            <form>
                <lightning:input aura:id="AccountName" name="New Account Name" label="Account Name"
                                 value="{!v.newAccount.Name}" required="true"/>
                <lightning:input aura:id="Description" name="New Account Name" label="Note"
                                 value="{!v.newAccount.Description}" required="true"/>
                <lightning:input aura:id="Categories" name="New Account Name" label="Categories"
                                 value="{!v.newAccount.Categories_del__c}" required="true"/>
                
                <lightning:select aura:id="myselection" value="{!v.selectValue}">
                    <aura:iteration items="{!v.options}" item="option">
                        <option value="{!option}">{!option}</option>
                    </aura:iteration>
                </lightning:select>
                
                <lightning:button label="Save" onclick="{!c.createAccount}" />
                
            </form>
        </center>
    </div>
</aura:component>


How to store Picklist and Lookup field ...?
Veena Sundara-HeraguVeena Sundara-Heragu
in your javascript method for createAccount, do this:

var newAccount = component.get("v.newAccount");
newAccount.Your_Field__c = component.find("myselection").get("v.value");