Created
December 15, 2012 03:08
-
-
Save mailtoharshit/4291018 to your computer and use it in GitHub Desktop.
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 OpportunityTrigger on Opportunity(before Update, after Update) { | |
for (Account acc: Trigger.New) { | |
//Creating instance of class for each trigger call | |
OpportunityRecordType art = OpportunityRecordType.getInstance(); | |
...... | |
} | |
} | |
public class OpportunityRecordType() { | |
//Lets add an instance property here | |
public static OpportunityRecord instance = null; | |
//public property | |
public String id { | |
get; | |
private set; | |
} | |
//public constructor | |
id = Opportunity.sObjectType.getDescribe().getRecordTypeInforByName().get('Opp').getRecordTypeId(); | |
public static OpportunityRecordType getInstance() { | |
if (instance == null) { | |
instance = new OpportunityRecordType(); | |
} | |
return instance; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment