Skip to content

Instantly share code, notes, and snippets.

View suddeb's full-sized avatar

Sudipta Deb suddeb

View GitHub Profile
handleButtonClick: function(component, event,helper){
......
}
({
fetchCases(component, event, helper){
helper.getCases(component);
}
})
@suddeb
suddeb / AccountHelper
Created April 25, 2015 15:50
AccountHelper Future Method
public class AccountHelper {
@future
public static void updateAccounts(Boolean value,List<Id> accountIds){
List<Account> allAccounts = [SELECT ID,notifyAdmin__c FROM ACCOUNT WHERE ID IN: accountIds];
for(Account anAccount : allAccounts){
anAccount.notifyAdmin__c=value;
}
if(allAccounts.size() > 0){
update allAccounts;
}
@suddeb
suddeb / TestAccountHelper
Created April 25, 2015 15:56
TestAccountHelper - Test Class for Future method
@isTest
public class TestAccountHelper {
public static Account clientAcc;
public static string salesforceLicenseId = [SELECT Id FROM profile WHERE Profile.UserLicense.Name='Salesforce' limit 1].id;
public static Market_Area__c Markt;
public static User salesforceLicUser;
private static void createUsers(){
salesforceLicUser = new User(
Alias = 'standt',
@suddeb
suddeb / HelloWorld
Last active August 29, 2015 14:19
HelloWorld
public class HelloWorld {
public String calculateDistance(){
Integer distance = calculateDistanceBetweenAB() +
calculateDistanceBetweenBC() +
calculateDistanceBetweenCD() +
calculateDistanceBetweenDA();
if(distance > 100){
return 'You should go by flight';
}else{
@suddeb
suddeb / EmployeeMap
Created April 26, 2015 15:32
EmployeeMap
public class EmployeeMap {
public void createEmployeeMapAndDisplay(){
Map<Integer, String> employeeMap = new Map<Integer, String>();
employeeMap.put(1, 'James');
employeeMap.put(2, 'Sudipta');
employeeMap.put(3, 'Christiaan');
employeeMap.put(4, 'Victor');
for(Integer index : employeeMap.keySet()){
System.Debug('Index: ' + index + ' Employee: ' + employeeMap.get(index));
@suddeb
suddeb / DistanceOperation
Last active August 29, 2015 14:20
DistanceOperation
public class DistanceOperation {
public static void calculateDistance(){
Double myCurrentLocationLatitude = 10.20;
Double myCurrentLocationLongitude = 10.20;
List<Account> allAccounts = [SELECT ID FROM ACCOUNT WHERE
DISTANCE(Head_Office_Location__c,
GEOLOCATION(:myCurrentLocationLatitude, :myCurrentLocationLongitude),'mi') < 1];
if(allAccounts.size() > 0){
System.Debug('Total number of accounts: ' + allAccounts.size());
}else{
@suddeb
suddeb / MyCustomType
Created May 10, 2015 15:19
MyCustomType Without Equals and Hashcode
public class MyCustomType {
public Integer myField {get;set;}
}
@suddeb
suddeb / TestEqualOperator
Created May 10, 2015 15:22
TestEqualOperator to compare
@isTest
public class TestEqualOperator {
static testMethod void testEqual(){
MyCustomType myCustomType1 = new MyCustomType();
myCustomType1.myField = 10;
MyCustomType myCustomType2 = new MyCustomType();
myCustomType2.myField = 10;
System.assertEquals(true, myCustomType1 == myCustomType2, 'Expected value is true');
@suddeb
suddeb / MyCustomType
Created May 10, 2015 15:43
MyCustomType with Equals Method Implemented
public class MyCustomType {
public Integer myField {get;set;}
public Boolean equals(Object o){
if(this === o){
return true;
}
if(!(o instanceof MyCustomType)){
return false;
}else{