Skip to content

Instantly share code, notes, and snippets.

@mailtoharshit
Created December 15, 2012 02:01
Show Gist options
  • Save mailtoharshit/4290536 to your computer and use it in GitHub Desktop.
Save mailtoharshit/4290536 to your computer and use it in GitHub Desktop.
trigger OpportunityTrigger on Opportunity (before Update, after Update)
{
//Poor Design
for (Account acc : Trigger.New)
{
//Creating instance of class for each trigger call
OpportunityRecordType art = new OpportunityRecordType()
......
}
}
public class OpportunityRecordType()
{
//public property
public String id {get; private set;}
//public constructor
id = Opportunity.sObjectType.getDescribe().getRecordTypeInforByName().get('Opp').getRecordTypeId();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment