Was wondering if anyone has come across a similar issue: I'm trying to run some apex code to insert some records. The code doesn't seem to do anything when it's running in my scratch org but mysteriously works when I run it as anonymous apex code in my dev console. Any ideas why? I'm still pretty new to Salesforce development so it might be something very obvious which I'm missing..
Some pseudo code of what it currently looks like:
List<Play__c> batch = new List<Play__c>();
for (Object p : plays) {
Map<String, Object> play = (Map<String, Object>) p;
Map<String, Object> player = (Map<String, Object>) play.get('player');
Map<String, Object> track = (Map<String, Object>) play.get('track');
Map<String, Object> user = (Map<String, Object>) play.get('user');
Map<String, Object> profile = (Map<String, Object>) user.get('profile');
String playerID = (String) player.get('id');
// skip events which have null playerID
if (participantID != null) {
Play__c newPlay = new Play__c();
newPlay.inviteId__c = (String) trackInvite.get('id');
newPlay.inviteTitle__c = (String) trackInvite.get('publicTitle');
}
}
insert batch;