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
rameshramesh 

my object is account i am using any 6 fields off object and after theree field i use one check box when check box is enable show last 3 fields in aura component

1

2

3
check box is enable then only show below fields

4

5

6
in aura component

Shivdeep KumarShivdeep Kumar
Hi Saki,

To show the fields or any section based on some conditions, Salesforce provide the aura:if OR aura:set. Please see the example below. 

// Aura Comp
<aura:component controller="AccountController">
    <aura:attribute name="accountList" type="List"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

<aura:iteration items="{!v.accountList}" var="accObj">
            <lightning:inputField fieldName="field1" value="{!accObj.field1}"/>
 <lightning:inputField fieldName="field2" value="{!accObj.field2}"/>
 <lightning:inputField fieldName="field3" value="{!accObj.field3}"/>
<aura:if isTrue="{!accObj.checkboxfield}">
 <lightning:inputField fieldName="field4" value="{!accObj.field4}"/>
 <lightning:inputField fieldName="field5" value="{!accObj.field4}"/>
 <lightning:inputField fieldName="field6" value="{!accObj.field6}"/>
</aura:if>                                          
        </aura:iteration>
</aura:component>

//Aura Js
({
    doInit: function (component, event, helper) {
        var action = component.get("c.getAccounts");
        action.setCallback(this, function(response){
            var state = response.getState();
            if(state == 'SUCCESS') {
                component.set('v.accountList', response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    }
});

//Apex class
public with sharing class AccountController {
    @AuraEnabled
    public static List<Account> getAccounts(){
        return[Select field1,field2,field3,field4,field5,field6,checkboxfield from Account];
    }
}
Thanks
Shivdeep Kumar