Skip to content

Instantly share code, notes, and snippets.

View swatimarda's full-sized avatar

Swati Marda swatimarda

View GitHub Profile
public with sharing class AccountTriggerHandler {
public static void handleBeforeInsert(List<Account> newAccounts){
for (Account a : newAccounts) {
if (a.Est_Annual_Sales__c >= 5000000) {
a.Priority__c = 'Highest';
} else if (a.Est_Annual_Sales__c >= 3000000) {
a.Priority__c = 'High';
} else if (a.Est_Annual_Sales__c >= 1000000) {
a.Priority__c = 'Standard';
public with sharing class WeekFourHomework {
//Let's practice calling different methods by writing our very own methods. You will write and save methods in the space below
//that call the existing methods you see already written here. Ready? Let's Go!
//Sample: Here is a public method that calls the getCitiesForExpansion below and prints the results to our debug log
public static void printOutCitiesForExpansionDemo() {
//The code on the left of the equals sign instantiates a list of Strings, the code on the right side calls our method and returns a list of cities
//the equals sign assigns the returned value, to the list we created
@swatimarda
swatimarda / PagingSortingController.cls
Created April 11, 2018 20:55 — 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];
}
}
@swatimarda
swatimarda / gist:26fa861ed11f1a14c40188a09529d548
Created January 31, 2018 22:25 — forked from nicocrm/gist:858086
SalesForce Apex CSV Parser
/**
* Used to read a delimited file.
*/
public class SSSCsvReader {
private String delim = ',';
// the input data
private String[] buffer;
public SSSCsvReader(String data){
this.buffer = data.split('\n');