Created
October 3, 2020 23:55
-
-
Save oakye/32ffedaf4387b5183f22c923898dc841 to your computer and use it in GitHub Desktop.
Salesforce Apex concept training. This quickly adds records into a custom object.
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
// Use this in Execute Anonymous to create 5 Stock Itme records | |
// where the inventory on hand is less than the minimum stock level | |
List<Stock_Item__c> itemList = new List<Stock_Item__c>(); | |
for (Integer i = 5; i < 10; i++) { | |
Stock_Item__c stockitem = new Stock_Item__c( | |
Description__c = 'An item of stock', | |
Item_Name__c = ('RAD Item ' + i), | |
List_Price__c = (14.99 + (i * 10)), | |
Minimum_Stock_Level__c = (50 + (i * 3)), | |
Stock_on_Hand__c = (20 + (i * 3)) | |
); | |
itemList.add(stockitem); | |
} | |
insert itemList; | |
System.debug('Added ' + itemList); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment