Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void onBeforeInsert(List newStockItems) {
- //List for existing items
- List<Stock_Item__c> existingStockItems = [SELECT Item_Name__c FROM Stock_Item__c];
- for(Stock_Item__c esi : existingStockItems){
- String existingStockItemName = esi.Item_Name__c;
- }
- system.debug('Number of Existing Items Pre-Insert'+ existingStockItems.size() );
- //List for new items
- List<Stock_Item__c> newStockItems = [SELECT Item_Name__c FROM Stock_Item__c];
- for (Stock_Item__c si : newStockItems){
- String newStockItemName = si.Item_Name__c;
- }
- system.debug('Number of New Stock Items'+ newStockItems.size() );
- }
- //If there is already a Stock Item with that name, change the
- //name so that it is the name entered, plus the words “Duplicate Item”.
- //We have a process in place to check for these elsewhere.
Add Comment
Please, Sign In to add comment