Skip to content

Instantly share code, notes, and snippets.

({
doInit : function(component, event, helper) {
var action = component.get("c.fetchMapData");
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
var custs = [];
var conts = response.getReturnValue();
for(var key in conts){
custs.push({value:conts[key], key:key}); //Here we are creating the list to show on UI.
<aura:application controller="sObjectDetailController" extends="force:slds">
<aura:attribute name="objName" type="String" default='Account'/>
<aura:attribute name="sObjects" type="sObject[]"/>
<aura:attribute name="fieldNames" type="String[]" default='["Id","Name","Owner.Name"]'/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<div class="slds-m-around_small">
<div class="slds-page-header">
<div class="slds-media">
<div class="slds-media__body">
({
doInit : function(component, event, helper) {
var action = component.get("c.getsendObjectDetails");
action.setParams({ objName : component.get("v.objName") });
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
//console.log("SUCCESS");
component.set("{!v.sObjects}", response.getReturnValue());
<aura:component >
<aura:attribute name="objName" type="String" />
<aura:attribute name="fieldName" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:formattedText aura:id="fielddata" />
</aura:component>
({
doInit : function(component, event, helper) {
var sobject = component.get('v.objName');
var fieldName = component.get('v.fieldName');
var formatText = component.find("fielddata");
if(!fieldName.includes('.')) {
formatText.set("v.value",sobject[fieldName]);
}
else {
console.log(sobject[fieldName.split(".")[0]]);
.THIS .slds-leftpad{
padding-left: 2rem;
}
.THIS .iconheight{
top: 65%;
}
.THIS .leftspace input {
padding-left:2rem;
}
public class DataTableController {
@AuraEnabled
public static DataTableWrapper initRecords(String ObjectName, String fieldNamesStr, String Orderby, String OrderDir) {
DataTableWrapper dtw = new DataTableWrapper();
List<LabelDescriptionWrapper> labelList = new List<LabelDescriptionWrapper>();
List<String> fieldSet = new List<String>();
Set<String> fieldNameSet = new Set<String>(fieldNamesStr.split(','));
<aura:component controller="RecordFormCompController" implements="flexipage:availableForRecordHome,force:hasRecordId,force:apphostable" access="global">
<aura:attribute name="sObjectName" type="String" default="Account" />
<aura:attribute name="iconName" type="String" default="account" />
<aura:attribute name="recordId" type="Id"/>
<lightning:card iconName="{!'standard:'+v.iconName}" title="{! 'New '+v.sObjectName}">
<div class="slds-p-left_large slds-p-right_medium">
<lightning:recordForm
objectApiName="{!v.sObjectName}"
recordId="{!v.recordId}"
layoutType="Full"
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="disabled" type="Boolean" default="false" />
<aura:attribute name="saved" type="Boolean" default="false" />
<aura:attribute name="showSpinner" type="Boolean" default="true" />
<aura:attribute name="sObjectName" type="String" default="Contact" />
<aura:attribute name="iconName" type="String" default="contact" />
<aura:attribute name="recordId" type="String" />
<aura:attribute name="pageReference" type="Object"/>
<lightning:navigation aura:id="navService"/>
public class ChildContactMapController {
@AuraEnabled
public static List<Address> contactAddressMap(String recordId) {
List<Address> adressList = new List<Address>();
List<Contact> conList = [SELECT ID, Name, MailingStreet, MailingCity, MailingState, MailingCountry, MailingPostalCode from Contact
WHERE AccountID =: recordId];
for(Contact con : conList) {
location location = new location(con.MailingStreet, con.MailingCity,con.MailingState,con.MailingCountry,con.MailingPostalCode);
adressList.add(new Address(location, con.Name));