• Zahra EL Hassani 10
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies


User-added image
​Hey!! Please help
how to add "reply and reply all" features in email ?
Hello Everyone,  In Batch Apex can anyone explain me what this,
"A callout failed because an Apex operation has pending uncommitted work. The Apex code needs to commit or roll back before callouts can be performed in the same transaction"

global class AMOUNT_amount implements Database.Batchable<sObject>{
    
    global Iterable<sObject> start(Database.BatchableContext context) 
    {    
        return [SELECT Id, ali_ttc_total_price__c,ali_client_id__c FROM ali_Ticket_Line__b]; 
        
    }

    global static void execute(Database.BatchableContext context, List<ali_Ticket_Line__b> scope){
        List<Account> accs = new List<Account>();
        Decimal adding_amount=0.0;
 
        
        for (ali_Ticket_Line__b s : scope)
        { 
            Account acc = [Select id , ali_purchases_amount_ttc_12__c from Account where id=: s.ali_client_id__c];
            List <ali_Ticket_Line__b> price=[SELECT id,ali_ttc_total_price__c FROM ali_Ticket_Line__b 
                                             WHERE (ali_Ticket_Line__b.ali_client_id__c=: acc.Id)];
                                           system.debug('aaa'+acc.ali_purchases_amount_ttc_12__c);
               
                    
                for(integer i=0;i<price.size();i++)
                {
                                                    system.debug('bbb'+acc.ali_purchases_amount_ttc_12__c);

                    adding_amount+=price[i].ali_ttc_total_price__c;
                    
                    acc.ali_purchases_amount_ttc_12__c=adding_amount;
                                system.debug('ccc'+acc.ali_purchases_amount_ttc_12__c);

                    accs.add(acc);
                    update acc;
                    
                 
                }
            
            system.debug('ddd'+acc.ali_purchases_amount_ttc_12__c);
            
            
map<id,account> accmap = new map<id,account>();
            
            accmap.putall(accs);
            if(accmap.size()>0){
                update accmap.values();
                                                system.debug('fff'+accmap.values());

                
            }
                    
            system.debug('eee'+acc.ali_purchases_amount_ttc_12__c);
                  
           }
    }
    

    
    global void finish(Database.BatchableContext bc)
    {
    }   
}
Hi Everyone,  In Batch Apex can anyone explain me what this <sObject> The requested operation is not supported by this SObject

global class AMOUNT_again implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext context) 
    {    
        return Database.getQueryLocator([SELECT ali_ttc_total_price__c,ali_client_id__c FROM ali_Ticket_Line__b]);   
    }
    global void execute(Database.BatchableContext context, List<sObject> scope){
        
        for (sObject s : scope)
        { ali_Ticket_Line__b a = (ali_Ticket_Line__b)s;
         {
             Account acc = [Select id , ali_purchases_amount_ttc_12__c from Account where id=: a.ali_client_id__c];
             
             acc.ali_purchases_amount_ttc_12__c=77.0;
             update acc;
         }
        }
    }
    
    global void finish(Database.BatchableContext bc)
    {
    }   
}