Skip to content

Instantly share code, notes, and snippets.

Sudipta Deb suddeb

Block or report user

Report or block suddeb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!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>
View gist:11cc554b0fbd2f1d4c17d752e01c93ea
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){
View SwitchFunction
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 {
View ContinuationExperimentPage
<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>
View ContinuationExperimentController
/*
* 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;
View ContinuationExperimentPage
<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>
View DynamicSOSLPractice
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'};
View DynamicSOSLStatement
List<List <sObject>> mySOSLQuery = search.query(<<DYNAMIC_SOSL_QUERY_STRING>>);
View CorrectDynamicSOQL
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');
View MyCustomObject
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');
You can’t perform that action at this time.