Skip to content

Instantly share code, notes, and snippets.

View clinto-thomas's full-sized avatar
♠️
Focusing

Clinto Thomas clinto-thomas

♠️
Focusing
View GitHub Profile
@msrivastav13
msrivastav13 / tasks.json
Created October 12, 2020 21:02
This one is for Retrieving org metadata using packages
{
"version": "2.0.0",
"tasks": [
{
"label": "SFDX: Retrieve Metadata From Package",
"type": "shell",
"command": "sfdx",
"args": [
"force:source:retrieve",
"-n",
@RatanPaul
RatanPaul / ApexCsvExample.java
Created July 7, 2020 09:57 — forked from douglascayers/ApexCsvExample.java
Apex CSV Example. Note the use of String.escapeCsv() method
String csv = 'Id,Name\n';
for ( List<Account> accts : [ SELECT id, name FROM Account LIMIT 10 ] ) {
for ( Account acct : accts ) {
csv += acct.id + ',' + acct.name.escapeCsv() + '\n';
}
}
ContentVersion file = new ContentVersion(
title = 'accounts.csv',
versionData = Blob.valueOf( csv ),
import { LightningElement } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
import ChatResource from '@salesforce/resourceUrl/Chat_Application_LWC';
export default class Chat_Application extends LightningElement {
renderedCallback() {
Promise.all([
loadScript(this, ChatResource + '/js/jquery.min.js'),
loadScript(this, ChatResource + '/js/jquery.mCustomScrollbar.min.js'),
global class AccountEmailService implements Messaging.InboundEmailHandler {
//describe call on Account object to fetch all fields and their Data type
public static Schema.DescribeSObjectResult objectDescribe = Account.getSObjectType().getDescribe();
public static Map<String, Schema.SObjectField> fields;
static{
fields = objectDescribe.fields.getMap();
}
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
sfdx force:doc:commands:list
=== Commands
force:alias:list # list username aliases for sfdx
force:alias:set # set username aliases for sfdx
force:apex:class:create # create an apex class
force:apex:execute # execute anonymous apex code
force:apex:log:get # fetch a debug log
force:apex:log:list # list debug logs
force:apex:test:report # display test results
force:apex:test:run # invoke apex tests
@douglascayers
douglascayers / AccountTrigger.trg
Created March 22, 2017 00:11
Example trigger that delegates to helper class.
trigger AccountTrigger on Account ( before insert, before update, before delete,
after insert, after update, after delete ) {
AccountTriggerHandler handler = new AccountTriggerHandler();
if ( Trigger.isBefore && Trigger.isInsert ) {
handler.handleBeforeInsert( Trigger.new );
}
else if ( Trigger.isBefore && Trigger.isUpdate ) {
handler.handleBeforeUpdate( Trigger.old, Trigger.oldMap, Trigger.new, Trigger.newMap );
trigger AccountTrigger on Account (after update) {
//prepare an empty Map of ID-to-Account for your updates
Map<ID, Account> acctMapToUpdate = new Map<Id, Account>();
//prepare a for-loop you can use to compare old and new field values
for(Integer i = 0 ; i < trigger.new.size() ; i++){
Account old = trigger.old[i];
Account nw = trigger.new[i];
//Evaluate Custom Settings to decide whether to execute actions
@mannharleen
mannharleen / DailyLeadProcessor.cls
Created November 3, 2016 15:00
Salesforce trailhead - Asynchronous Apex Scheduling Jobs Using the Apex Scheduler
public class DailyLeadProcessor implements schedulable{
public void execute(schedulableContext sc) {
List<lead> l_lst_new = new List<lead>();
List<lead> l_lst = new List<lead>([select id, leadsource from lead where leadsource = null]);
for(lead l : l_lst) {
l.leadsource = 'Dreamforce';
l_lst_new.add(l);
}
update l_lst_new;