You need to sign in to do that
Don't have an account?
Mohammed Ayyub
Tips to decrease the SOQLs
Replace each query by schema describe call:
Replcae this:
Replcae this:
//REPLACE THIS LINE RecordType closedWonRecordType = [SELECT Id from RecordType WHERE SobjectType = 'Opportunity' AND Name = 'Closed Won ' LIMIT 1]; //FROM Id closedWonRecordTypeId = Opportunity.getDescribe().getRecordTypeInfosByName().get('Closed Won').getRecordTypeId();
We have developed a Utilities class that stores these all in a static Map, which means you don't need to call the schema multiple times for the same object: