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
MUSFAR KT 6MUSFAR KT 6 

how to use field set in lightning component for form edit and view

how to use fieldset in lightning component for creation of  form edit and view in the account object
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Musfar,

Please refer below link which might help you in this
https://superqbit.com/2019/08/08/dynamic-lightning-record-edit-form-using-field-sets/
https://www.sfdcpanther.com/how-to-use-field-set-in-lightning-component/
https://metillium.com/2018/02/lightning-field-set-form-component-v2/

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards
 
MUSFAR KT 6MUSFAR KT 6
Hi Devi Chandrika,

This link is "https://superqbit.com/2019/08/08/dynamic-lightning-record-edit-form-using-field-sets/"  very helpful.

I tried another method but it showing all sections in this form. actually, I need Account information section only in this form.how will I achieve this scenario any idea?  I mentioned my code below


<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName" access="global" >
    <aura:attribute name="sObjectName" type="String" default="Pet__c" />
    <lightning:card iconName="custom:custom19" title="lightning:recordForm">
        <div class="slds-p-left_large slds-p-right_medium">    
            <lightning:recordForm aura:id="recordViewForm" 
                                  objectApiName="Account"
                                  fields="Name,AccountNumber,Type,Industry,Phone,City"
                                  columns="2"
                                  layoutType ="Full"
                                  mode="edit"
                                  onsuccess="{!c.onSuccess}"
                                  onsubmit="{!c.onSubmit}"
                                  onload="{!c.onLoad}"
                                  onerror="{!c.onError}"
                                  />   
            
        </div>
    </lightning:card>
    <lightning:card iconName="custom:custom19" title="Edit lightning:recordForm">
        <div class="slds-p-left_large slds-p-right_medium">    
            <lightning:recordForm aura:id="recordViewForm" 
                                  objectApiName="Account"
                                  columns="2"
                                  fields="Name,AccountNumber,Type,Industry,Phone,City"
                                  recordId="0016F00003d15i1"
                                  layoutType ="Full"
                                  mode="View"
                                  onsuccess="{!c.onSuccess}"
                                  onsubmit="{!c.onSubmit}"
                                  onload="{!c.onLoad}"
                                  onerror="{!c.onError}"
                                  />   
            
        </div>
    </lightning:card>
    
    <lightning:card iconName="custom:custom19" title="Read Only lightning:recordForm">
        <div class="slds-p-left_large slds-p-right_medium">    
            <lightning:recordForm aura:id="recordViewForm" 
                                  objectApiName="Account"
                                  columns="2"
                                  fields="Name,AccountNumber,Type,Industry,Phone,City"
                                  recordId="0016F00003d15i1"
                                  layoutType ="Full"
                                  mode="readonly"
                                  onsuccess="{!c.onSuccess}"
                                  onsubmit="{!c.onSubmit}"
                                  onload="{!c.onLoad}"
                                  onerror="{!c.onError}"
                                  />   
            
        </div>
    </lightning:card>
    
</aura:component>




({
    onSuccess : function(component, event, helper) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "The record has been Saved successfully."
        });
        toastEvent.fire();
    },
    onSubmit : function(component, event, helper) {
    },
    onLoad : function(component, event, helper) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Loaded!",
            "message": "The record has been Loaded successfully ."
        });
        toastEvent.fire();
    },
    onError : function(component, event, helper) {
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Error!",
            "message": "Error."
        });
        toastEvent.fire();
    }
    
    
})