Skip to content

Instantly share code, notes, and snippets.

@keshak1
keshak1 / PagingSortingController.cls
Created January 6, 2021 09:17 — forked from brianmfear/PagingSortingController.cls
Lightning Paging and Sorting Demo
global class PagingSortingController {
@AuraEnabled global static Account[] getAccounts() {
return [SELECT Name, Industry, AnnualRevenue FROM Account LIMIT 1000];
}
}
trigger LeadTrigger on Lead (before insert, after insert, before update, after update,
before delete, after delete, after undelete) {
new LeadTriggerHandler().run();
}
public virtual class TriggerHandler {
// Current context of the trigger, overridable in tests
@TestVisible
private TriggerContext context;
// Constructor
public TriggerHandler() {
this.setTriggerContext();
}
public class LeadTriggerHandler extends TriggerHandler {
List<Lead> newLeads;
public LeadTriggerHandler(){
newLeads = (List<Lead>) Trigger.new;
}
public override void beforeInsert() {
Set<String> companyNames = new Set<String>(); // Will hold the set of Lead Company Names
@keshak1
keshak1 / FileController.cls
Created April 15, 2020 09:03 — forked from peterknolle/FileController.cls
Lightning File Upload Component
public class FileController {
@AuraEnabled
public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
Attachment a = new Attachment();
a.parentId = parentId;
a.Body = EncodingUtil.base64Decode(base64Data);
@keshak1
keshak1 / Lookup.cmp.html
Created December 29, 2019 21:31 — forked from JitendraZaa/Lookup.cmp.html
Salesforce Lightning Lookup component - Pure SLDS and Javascript based
<aura:component controller="Lookup">
<aura:attribute Name="selItem" type="object" access="public"
description="This attribute can be used by parent component to read selected record"/>
<aura:attribute Name="server_result" type="object[]" access="private" />
<aura:attribute name="lookupIcon" type="String" access="public" default="standard:contact"/>
<aura:attribute name="objectName" type="String" access="public"
description="Name of Object to be searched"/>
<aura:attribute name="field_API_text" type="String" access="public"
@keshak1
keshak1 / componentEvent.evt
Created December 29, 2019 21:28 — forked from pozil/componentEvent.evt
Lightning - Passing data up the component hierarchy via a component event
<aura:event type="COMPONENT">
<aura:attribute name="param" type="String"/>
</aura:event>
@keshak1
keshak1 / childComponentWithMethod.cmp
Created December 29, 2019 21:25 — forked from pozil/childComponentWithMethod.cmp
Lightning - Passing data down the component hierarchy via a method
<aura:component >
<aura:method name="myMethod" action="{!c.executeMyMethod}">
<aura:attribute name="param1" type="String"/>
<aura:attribute name="param2" type="String"/>
</aura:method>
</aura:component>