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 class AccountTriggerHandler { | |
//After Insert Handler | |
public class AccountAfterInsertHandler implements MyTriggers.Handler{ | |
public void handle(){ | |
System.Debug(LoggingLevel.INFO,'Inside AccountAfterInsertHandler'); | |
} | |
} | |
//Before Insert Handler | |
public class AccountBeforeInsertHandler implements MyTriggers.Handler{ |
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
trigger AccountTrigger on Account (before insert,after insert) { | |
new MyTriggers() | |
.attach(MyTriggers.Evt.afterInsert, new AccountTriggerHandler.AccountAfterInsertHandler()) | |
.attach(MyTriggers.Evt.beforeInsert, new AccountTriggerHandler.AccountBeforeInsertHandler()) | |
.attach(MyTriggers.Evt.beforeUpdate, new AccountTriggerHandler.AccountBeforeUpdateHandler()) | |
.run(); | |
} |
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 class AccountTriggerHandler { | |
//After Insert Handler | |
public class AccountAfterInsertHandler implements MyTriggers.Handler{ | |
public void handle(){ | |
System.Debug(LoggingLevel.INFO,'Inside AccountAfterInsertHandler'); | |
} | |
} | |
//Before Insert Handler | |
public class AccountBeforeInsertHandler implements MyTriggers.Handler{ |
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 class MyTriggers { | |
/* Enum representing all the contexts available */ | |
public enum Evt { | |
afterDelete, afterInsert,afterUndelete,afterUpdate,beforeDelete,beforeInsert,beforeUpdate | |
} | |
public interface Handler{ | |
void handle(); | |
} | |
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 class SecondPageController { | |
public String firstName {get;set;} | |
//Constructor | |
public SecondPageController(){ | |
firstName = System.currentPageReference().getParameters().get('firstName'); | |
} | |
} |
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 controller="SecondPageController"> | |
Hello {!firstName} | |
</apex:page> |
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 > | |
<apex:outputLink value="/apex/SecondPage">Click Here -> Second Page | |
<apex:param name="firstName" value="Sudipta"/> | |
</apex:outputLink> | |
</apex:page> |
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 > | |
<br/> | |
<apex:pageBlock title="Account Name"> | |
<apex:pageBlockSection > | |
<apex:outputText value="{!$CurrentPage.parameters.accountName}"></apex:outputText> | |
</apex:pageBlockSection> | |
</apex:pageBlock> | |
</apex:page> | |
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 void getMySObjectType(){ | |
Task MyTask = [Select Id, WhatId from Task where WhatId <> null limit 1]; | |
String ObjName = MyTask.WhatId.getSObjectType().getDescribe().getName(); | |
System.Debug('Object Name: ' + ObjName); | |
} |
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 void getAllSObjects(){ | |
map<String, Schema.SObjectType> GlobalSObjectMap = Schema.getGlobalDescribe(); | |
for (Schema.SObjectType Obj : GlobalSObjectMap.values()) { | |
Schema.DescribeSObjectResult ObjDesc = Obj.getDescribe(); | |
system.debug('Object Name: ' + ObjDesc.getName()); | |
} | |
} |