Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get the static resource name and path for the JSON file
- String resourceName = 'insert_static_resource_name_here';
- String resourcePath = '/resource/' + resourceName;
- // Read the JSON file from the static resource
- String jsonString = System.resource.getResourceAsString(resourcePath);
- // Deserialize the JSON string into a list of custom objects
- List<Account__c> newAccounts = (List<Account__c>) JSON.deserialize(jsonString, List<Account__c>.class);
- // Insert the new records into Salesforce
- insert newAccounts;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement