We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

0

When using System.scheduleBatch, if you always use the same name every time for scheduling this batch, an attempt to schedule the batch whilst it is already scheduled will result in an exception and the batch won't get double scheduled. You can use the Async Apex Jobs table to provide info about whether the specified batch is already executing and you might ...


0

CPU time limit is exceeding due to processing of large number of records with given logic. https://welkinsuite.com/blog/how-to-get-past-apex-cpu-limits/ Apart from this, you can call Batch class from Process builder or Trigger. You can try with Batch from Trigger and run it Async. Using Code you can put your logic to filter out only those records need to be ...


0

After you upsert listAttendanceRate you do not reinitilize it. So after you upserted entries for all users, you just keep adding additional entries (with the same external ID). This explains why it is not happening if the activity is only today - you only call upsert once. move listAttendanceRate = new List(); to before your loop over the users, and you ...


0

You should use Databse.SaveResult for individually checking success/failure of each record update or insert. if(!contactToUpdate.isEmpty()){ Database.SaveResult[] updateResults = Database.update(contactToUpdate, false); List<SIS_Staging__c> errsStaging = new List<SIS_Staging__c>(); for(Integer i=0;i<updateResults....


0

Use Database.insert which is partial insert the collection of data, please read Database.insert() Doc List<Database.SaveResult> saveResultList = Database.insert(insertList, false); // Iterate through saveResultList based on isSuccess capture the failed records for (Database.SaveResult sr : saveResultList) { if (!sr.isSuccess()) { // ...


Top 50 recent answers are included