This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class TaskTriggerHandler { | |
public void handleTaskCreation(){ | |
List<Task> allTasks = [ SELECT | |
TYPEOF What | |
WHEN Case THEN Id, CaseNumber | |
WHEN Account THEN Id, Name | |
END | |
FROM TASK Where Id in: Trigger.new | |
]; | |
for(Task singleTask : allTasks){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class SwitchFunction { | |
public static void switchOnString(String value){ | |
switch on value { | |
when 'India' { | |
System.Debug('I am in India'); | |
}when 'Canada' { | |
System.Debug('I am in Canada'); | |
}when else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page showHeader="false" sidebar="false" controller="ContinuationExperimentController"> | |
<apex:form> | |
<apex:pageBlock title="Experiment with Continuation - Calling Service Async"> | |
<apex:commandButton action="{!callService}" value="Call Service" reRender="response" /> | |
</apex:pageBlock> | |
<apex:pageBlock title="Response received from Service" id="response"> | |
<pre>{!res}</pre> | |
</apex:pageBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author : Sudipta Deb | |
* Blog : www.sudipta-deb.in | |
*/ | |
public with sharing class ContinuationExperimentController { | |
public String res {get;set;} | |
public String resLongRunServ {get;set;} | |
public String continuationId; | |
public String continuationIdLongRunSrv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page showHeader="false" sidebar="false" controller="ContinuationExperimentController"> | |
<apex:form> | |
<apex:pageBlock title="Experiment with Continuation Object - Calling Service Async"> | |
<apex:commandButton action="{!callService}" value="Call Service" reRender="response" /> | |
</apex:pageBlock> | |
<apex:pageBlock title="Response received from Service" id="response"> | |
<pre>{!res}</pre> | |
</apex:pageBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class DynamicSOSLPractice { | |
/* | |
This method will prepare SOSL statement to search for the keyword in all the fields for the objects | |
Account, Lead, Contact, sudipta__Book__c | |
*/ | |
public static void testDynamicSOSL(){ | |
String soslString = ''; | |
String searchKeyword = 'Salesforce'; | |
List<String> requiredsObjects = new List<String>{'Account', 'Lead', 'Contact','sudipta__Book__c'}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<List <sObject>> mySOSLQuery = search.query(<<DYNAMIC_SOSL_QUERY_STRING>>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyCustomObject__c newCustomObject = new MyCustomObject__c(myCustomField__c ='My Custome Field'); | |
String fieldValue = newCustomObject.myCustomField__c; | |
List<sObject> sObjList = Database.query('SELECT Id FROM MyCustomObject__c WHERE myCustomField__c = :fieldValue'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyCustomObject__c newCustomObject = new MyCustomObject__c(myCustomField__c ='My Custome Field'); | |
List<sObject> sObjList = Database.query('SELECT Id FROM MyCustomObject__c WHERE myCustomField__c = :newCustomObject.myCustomField__c'); |
NewerOlder