Skip to content

Instantly share code, notes, and snippets.

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:application extends="force:slds">
<aura:attribute name="userData" type="List" default="[]"/>
<aura:attribute name="tableHeight" type="Integer" default="450"/>
<aura:attribute name="sortedDirection" type="String" default="DESC"/>
<aura:attribute name="inlineEdit" type="boolean" default="true"/>
<aura:attribute name="enableColAction" type="boolean" default="true"/>
<c:DataTableLazyLoading selectedData="{!v.userData}" tableHeight="{!v.tableHeight}"
sortedDirection="{!v.sortedDirection}" inlineEdit="{!v.inlineEdit}"
enableColAction ="{!v.enableColAction}"/>
public String getAccessToken() {
// Ignore the File upload part and "jwt.pkcs" if you used a Salesforce certificate to sign up
// for an Einstein Platform account
ContentVersion base64Content = [SELECT Title, VersionData FROM ContentVersion where Title='einstein_platform' OR Title='predictive_services' ORDER BY Title LIMIT 1];
String keyContents = base64Content.VersionData.tostring();
keyContents = keyContents.replace('-----BEGIN RSA PRIVATE KEY-----', '');
keyContents = keyContents.replace('-----END RSA PRIVATE KEY-----', '');
keyContents = keyContents.replace('\n', '');
// Get a new token
<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 controller="CustomSearchController" implements="forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<aura:attribute name="searchText" type="String" default=""/>
<aura:attribute type="list" name="recordList" />
<aura:attribute name="Label" type="String"/>
<aura:attribute name="required" type="Boolean" default="false"/>
<lightning:card iconName="utility:search" title="Global Search">
<div class="slds-form-element__control slds-input-has-icon slds-input-has-icon slds-input-has-icon_left-right" role="none">
<lightning:input required="{!v.required}" aura:id="userinput" label="{!v.Label}" name="searchText" onchange="{! c.handleClick }" value="{!v.searchText}" class="leftspace"/>
<span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right iconheight">
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));
({
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 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"/>
({
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.
.THIS .slds-leftpad{
padding-left: 2rem;
}
.THIS .iconheight{
top: 65%;
}
.THIS .leftspace input {
padding-left:2rem;
}