How to fetch all custom settings values using Apex and Iterate the custom list values on lightning component after that custom settings navigation through edit/back button in custom setting Salesforce | how to get value, view edit list, or back navigation button of custom settings Salesforce

2,637 views


Hey guys, today in this post we are going to learn about How to fetch all custom settings values using Apex and Iterate the custom list values on lightning component after that custom settings navigation through edit/back button in custom setting Salesforce.

How to get value, view edit list, or back navigation button of custom settings salesforce

Files we used to fetch all custom settings values in this post example

customSettingCmp.cmp Lightning Component It is used for create a table for Iterate the custom setting list values on lightning component
customSettingCmpController.js JavaScript Controller File It is hold Javascript doInit functionality.
customSettingCmpHelper.js JavaScript Controller Helper File It is hold for Javascript Helper Function to get Custom setting values from apex method
customSettingCmpCtrl.apxc Apex Class Controller It is used for get List of Custom Setting values from Apex Class Method

Live Demo

Note:: – You will get an email, so put correct email and mobile number and BEGIN YOUR JOURNEY from Today!
   

salesforce custom settings edit list/back navigation -- w3web.net

 

You can download file directly from github by Click Here.

 

Other related post that would you like to learn in Salesforce

 

  • Find the below steps

Create Lightning Component

Step 1:- Create Lightning Component : customSettingCmp.cmp

From Developer Console >> File >> New >> Lightning Component

customSettingCmp.cmp [Lightning Component File]

Note:: – You will get an email, so put correct email and mobile number and BEGIN YOUR JOURNEY from Today!
 
 
  1.    <aura:component controller="customSettingCmpCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">    
  2.     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  3.     <aura:attribute name="awsList" type="List"/>
  4.     <aura:attribute name="cmpStr" type="String" default="list"/>    
  5.     <lightning:card>
  6.           <div class="slds slds-p-around_medium">
  7.               <aura:if isTrue="{!v.cmpStr == 'list'}">
  8.                 <table class="slds-table slds-table_bordered slds-table_col-bordered">
  9.                     <thead>
  10.                         <tr>
  11.                             <th class="slds-hide">Id</th>
  12.                             <th>View Log</th>
  13.                             <th>Name</th>
  14.                             <th>API Endpoint</th>                            
  15.                             <th>Other Attribute Three</th>
  16.                             <th>Other Attribute Four</th>
  17.                             <th>Other Attribute One</th>
  18.                         </tr>
  19.                     </thead>
  20.                     <tbody>
  21.                         <aura:iteration items="{!v.awsList}" var="item">
  22.                             <tr>
  23.                                <td class="slds-hide">{!item.Id}</td> 
  24.                                 <td><a id="{!item.Id}" onclick="{!c.navigateToDetail}">View Log</a></td>
  25.                                 <td>{!item.Name}</td>
  26.                                 <td>{!item.API_Endpoint__c}</td>
  27.                                 <td>{!item.Other_Attribute_Three__c}</td>
  28.                                 <td>{!item.Other_Attribute_Four__c}</td>                                
  29.                                 <td>{!item.Url_Attribute_One__c}</td>
  30.                             </tr>
  31.                         </aura:iteration>
  32.                     </tbody>
  33.                 </table>
  34.                   <aura:set attribute="else">
  35.                     <div class="slds-page-header">  
  36.                     <div class="slds-grid slds-gutters">
  37.                        <div class="slds-col slds-size_8-of-12"> 
  38.                            <div class="slds-media">
  39.                             <div class="slds-media__figure">
  40.                                 <span class="slds-icon_container slds-icon-standard-opportunity" title="opportunity">
  41.                                     <lightning:icon iconName="custom:custom34" title="Debug Logs" />
  42.                                     <span class="slds-assistive-text">Debug Log</span>
  43.                                 </span>
  44.                             </div>
  45.                             <div class="slds-media__body">
  46.                                 <div class="slds-page-header__name">
  47.                                     <div class="slds-page-header__name-title">
  48.                                     <h1>
  49.                                         <span class="slds-page-header__title slds-truncate" title="Mobile App Logs">Api Log Id</span>
  50.                                     </h1>
  51.                                     </div>
  52.                                 </div>
  53.                             </div>
  54.                         </div>
  55.                        </div> 
  56.                        <div class="slds-col slds-size_4-of-12 slds-text-align_right"> 
  57.                           <lightning:button  variant="brand" label="Back" name="btnBack" title="Back" onclick="{! c.navigateToList}" />                          
  58.                          </div>  
  59.                     </div>
  60.                   </div>                        
  61.                     <div class="slds-grid slds-wrap">
  62.                        <div class="slds-col slds-size_6-of-12 slds-p-horizontal_small slds-m-bottom_small"><lightning:input type="text" aura:id="awsName"   name="awsName"  label="Name" value="{!v.awsList[0].Name}"/></div>
  63.                        <div class="slds-col slds-size_6-of-12 slds-p-horizontal_small"><lightning:input type="text" aura:id="awsEndpoint" name="awsEndpoint"  label="Endpoint" value="{!v.awsList[0].API_Endpoint__c}"/></div> 
  64.                     </div>  
  65.  
  66.                   </aura:set>  
  67.               </aura:if>    
  68.           </div>
  69.     </lightning:card>
  70. </aura:component>

Create JavaScript Controller

Step 2:- Create Lightning Component : customSettingCmpController.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Controller

customSettingCmpController.js [JavaScript Controller]

  1.   ({
  2. 	doInit : function(component, event, helper) {
  3. 		helper.doInitHelper(component);
  4. 	},
  5.  
  6.      navigateToDetail:function(component, event,helper){        
  7.        var navId = event.target.getAttribute('id');
  8.         component.set("v.cmpStr",'detail');
  9.         component.set("v.viewLogId",navId);
  10.     },
  11.  
  12.     navigateToList:function(component, event,helper){        
  13.        var navId = event.target.getAttribute('id');
  14.         component.set("v.cmpStr",'list');
  15.     },
  16.  
  17.  
  18. })

Create JavaScript Helper

Step 3:- Create Lightning Component : customSettingCmpHelper.js

From Developer Console >> File >> New >> Lightning Component >> JavaScript Helper

customSettingCmpHelper.js [JavaScript Helper File]

  1.   ({
  2. 	doInitHelper : function(component, event, helper) {       
  3. 	 var action = component.get("c.getCustomSettingLogs");       
  4.         action.setCallback(this, function(response){
  5.             var state = response.getState();
  6.             if(state == "SUCCESS"){
  7.                 var result = response.getReturnValue();
  8.  
  9.                 component.set('v.awsList', result);
  10.             }
  11.         });
  12.         $A.enqueueAction(action);
  13.  
  14. 	},    
  15. })

Create Apex Class Controller

Step 4:- Create Apex Class : customSettingCmpCtrl.apxc

From Developer Console >> File >> New >> Apex Class

customSettingCmpCtrl.apxc [Apex Class Controller]

  1.    public class customSettingCmpCtrl {
  2.   @AuraEnabled 
  3.     public static List<aws_integration__c> getCustomSettingLogs(){
  4.         //aws_integration__c awsIntgrt = aws_integration__c.getValues(constantsCtrl.amazonS3Manage);
  5.         List<aws_integration__c> awsIntgrt = aws_integration__c.getAll().values();
  6.         system.debug('awsIntgrt ' + awsIntgrt);        
  7.         RETURN awsIntgrt;
  8.     }
  9.  
  10.  
  11. }

 

salesforce custom settings edit list/back navigation -- w3web.net

 

Further post that would you like to learn in Salesforce

 

 

 

FAQ (Frequently Asked Questions)

What is use of custom settings in Salesforce?

Custom settings are similar to custom objects in that they let you customize org data. Custom settings also let you distinguish particular users or profiles based on custom criteria.

How do I change custom settings in Salesforce?

Go to Setup | Home | Data | Schema Settings and Enable 'Manage List Custom Settings Type'.

Can we update custom setting in Apex?

We can query or we can use getInstance() to get the value and then we can use update keyword to update the Custom Settings value.

Related Topics | You May Also Like

 
Note:: – You will get an email, so put correct email and mobile number and BEGIN YOUR JOURNEY from Today!
 
 
  

Our Free Courses →

👉 Get Free Course →

đź“Ś Salesforce Administrators

đź“Ś Salesforce Lightning Flow Builder

đź“Ś Salesforce Record Trigger Flow Builder

👉 Get Free Course →

đź“Ś Aura Lightning Framework

đź“Ś Lightning Web Component (LWC)

đź“Ś Rest APIs Integration



Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

Leave a Comment