Created
October 3, 2020 23:57
-
-
Save oakye/c5d58c46dc7304c44c6ea47df43767a3 to your computer and use it in GitHub Desktop.
Salesforce Apex code to quickly create 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 Item records | |
// where the inventory on hand is greater than the minimum stock level | |
List<Stock_Item__c> itemList = new List<Stock_Item__c>(); | |
for (Integer i = 0; i < 5; i++) { | |
Stock_Item__c stockitem = new Stock_Item__c( | |
Description__c = 'An item of stock', | |
Item_Name__c = ('RAD Item ' + i), | |
List_Price__c = (20.00 + (i * 10)), | |
Minimum_Stock_Level__c = (50 + (i * 10)), | |
Stock_on_Hand__c = (75 + (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