function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jamal ArogundadeJamal Arogundade 

Create allocation for a new opportunity

// Query Opportunities where Stage is pledged , The SOQL will have Recurring Donation ID as well in WHERE condition
            // run a loop on List of Opps reterived in step 1
            // Create Allocation for each opp, Allocation you have created, should be added to a new list of type Allocation__c
            // Insert Allocation lIts


List<Opportunity> oppList = [SELECT ID FROM Opportunity WHERE StageName = 'pledged'];
            for (Opportunity opps: oppList){
                Allocation__c alls = new Allocation__c ();
                alls.Opportunity__c = opps.id;
            }
            insert oppList;
        }
Jamal ArogundadeJamal Arogundade
FYI: I am a newbie to Apex, would like some help on fixing this code