• AviKesari
  • NEWBIE
  • 40 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies
Hi Folks,

I'm getting the following error:

Apex trigger TaskTrigger caused an unexpected exception, contact your administrator: TaskTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 0010c00001zZtfnAAC; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []: ()

I have a trigger on Task and apex handler class which executes on after insert and after  update.

When a user logs a call either from account and contact(which have lookup relationship) then custom fields on account should get updated.

This works fine with sys admin credential but when i login and test as  a specific profile user. They get the error, the field is editable and apex class is enabled account has read, write and edit permission but not view all or modify all.

Can I make this code gets executed for any user and any profile meaning as a sys admin, How can I do this?
Hi all,
I'm trying to get the account ID's from contact(lookup realtionship not Master detail).

 public void updateAccountActivityFields(Task[] taskRecords){
 Set<String> conIDs = new Set<String>();
 for(Task t : taskRecords){
            conIDs.add(t.WhoID);
        } 
//query outside forloop
//Account and contact have lookup relationship
 Map<Id,Contact> conmap = new Map<Id,Contact>([SELECT AccountId FROM Contact WHERE Id IN :conIDs]);

//returns NO value for accountsToUpdate, But When I debug only for conmap.keyset() I see the account ID..need help!!
List<Account> accountsToUpdate = [SELECT Id FROM Account WHERE Id IN :conmap.keyset()];
            
 for(Task t: [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, WhoID, WhatID FROM task WHERE id in :taskRecords]){
for(Account a : accountsToUpdate){
//Logic here
}
}
I have a trigger on TASK and handler class which is on After Insert and After Update, updates custom fields on account.

for Task - contact (whoId) is required field.
when a user logs a call from contact, he may not enter the WhatID(Account). So i'm trying to query and get the WhatId from WhoId of a task adn also trying to Bulkify Code.

HandlerClass:

 public void updateAccountActivityFields(Task[] taskRecords){
 Set<String> conIDs = new Set<String>();
 for(Task t : taskRecords){
            conIDs.add(t.WhoID);
        } 
//query outside forloop
//Account and contact have lookup relationship
 List<Contact> accIDs = [SELECT AccountId FROM Contact WHERE Id IN :conIDs];

//getting ERROR at this line 
List<Account> accountsToUpdate = [SELECT Id FROM Account WHERE Id IN :accIDs];

 for(Task t: [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, WhoID, WhatID FROM task WHERE id in :taskRecords]){
for(Account a : accountsToUpdate){
//Logic here
}
}
}

 
I'm trying to get the Id's of the account with most recent createddate and created by fields of Task. Please help me with SOQL, Thanks!
Hi All,

I am getting below error :

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    
    public TaskTriggerHandler(){
        
    }
    
    public void OnAfterInsert(Task[] newObjects){
        // EXECUTE AFTER INSERT LOGIC
        updateAccountActivityFields(newObjects);
    }
    
    public void OnAfterUpdate(Task[] oldObjects, Task[] updatedObjects, Map<ID, Task> ObjectMap){
        //EXECUTE AFTER UPDATE LOGIC
        updateAccountActivityFields(updatedObjects);
    }
    
    public void updateAccountActivityFields(Task[] taskRecords){
    /* when a task of RecordType(Safelite_Task_Record_Type) is created/updated either from Account or Contact then 
    update Account fields : Last_Face_to_Face_Activity__c, Last_Visited_By__c & Last_Call_Activity__c based on task type
    */
        // find task record type 
        RecordType taskRec = [SELECT Id FROM RecordType WHERE SobjectType ='Task' AND DeveloperName ='Safelite_Task_Record_Type'];
        
        //Set of Account IDs getting updated
        Set<ID> aid = new Set<ID>();
        List<Account> accountsToUpdate = new List<Account>();
        Account a;
        
        //Map of Account IDs and Accounts
        Map<id,account> accMap = new Map<id,account>();
        
        //Get all the contactIds and accountIds of the task being inserted/updated
        for(Task tk : [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, whoid, whatid FROM task WHERE id in :taskRecords]){
            if(tk.RecordTypeId == taskRec.Id  && tk.Whoid!=null){
                
                aid.add(tk.whatid); 
                a = new Account(id = tk.WhatId);
                
                //convert task's CreatedDate, datetime to date
                Date createdDateJustDate = date.newinstance(tk.CreatedDate.year(), tk.CreatedDate.month(), tk.CreatedDate.day());
                
                //update the activity fields on account with Task's lastModifiedDate and LastModifiedBy based on Task Type
                if(tk.type=='Face 2 Face Meeting' || tk.type=='Lunch'){
                    a.Last_Face_to_Face_Activity__c = createdDateJustDate;
                    a.Last_Visited_By__c = tk.LastModifiedBy.name;
                }
                else{
                    a.Last_Call_Activity__c =  createdDateJustDate;
                }
                //Populate accMap with the Account IDs and Account record
                accountsToUpdate.add(a);
                accMap.put(a.id,a);
            }
        }
        if(!accMap.isEmpty()){
            Update accMap.values();
        }
    }
}
Hi All,

I have trigger on after insert and after update, below is my handler class.

If i create a task from contact(is a required field on page layout) it fails because whatID is null. So I'm trying to query to get the whatID based on whoID.

If i create a task from account, works fine because whoid and whatid are not null.

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    
    public TaskTriggerHandler(){
        
    }
    
    public void OnAfterInsert(Task[] newObjects){
        // EXECUTE AFTER INSERT LOGIC       updateAccountActivityFields(newObjects);
    }
    
    public void OnAfterUpdate(Task[] oldObjects, Task[] updatedObjects, Map<ID, Task> ObjectMap){
        //EXECUTE AFTER UPDATE LOGIC
        updateAccountActivityFields(updatedObjects);
    }
    

     public void updateAccountActivityFields(Task[] taskRecords){
      
        // find task record type 
        RecordType taskRec = [SELECT Id FROM RecordType WHERE SobjectType ='Task' AND DeveloperName ='Task_Record_Type'];
        
        List<Account> accountsToUpdate = new List<Account>();
        Account a;
       
        //Get all the contactIds and accountIds of the task being inserted/updated
        for(Task tk : [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, whoid, whatid FROM task WHERE id in :taskRecords]){
            if(tk.RecordTypeId == taskRec.Id  && tk.Whoid!=null){
                
                // query to get account ID from contact:whoID 
                a = new Account(Id = [SELECT AccountId FROM Contact  WHERE Id =: tk.WhoId Limit 1].AccountId);
                //convert task's CreatedDate, datetime to date
                Date createdDateJustDate = date.newinstance(tk.CreatedDate.year(), tk.CreatedDate.month(), tk.CreatedDate.day());
        
                //update the activity fields on account with Task's lastModifiedDate and LastModifiedBy based on Task Type
                if(tk.type=='Face 2 Face Meeting' || tk.type=='Lunch'){
                    a.Last_Face_to_Face_Activity__c = createdDateJustDate;
                    a.Last_Visited_By__c = tk.LastModifiedBy.name;
      
                }
                else{
                    a.Last_Call_Activity__c =  createdDateJustDate;
                    
                }
                
                accountsToUpdate.add(a);
               
            }
        }
        
       if(!accountsToUpdate.isEmpty())
            Update accountsToUpdate;

My test Class :

Please help!!
    
    public void OnAfterUpdate(Task[] oldObjects, Task[] updatedObjects, Map<ID, Task> ObjectMap){
        //EXECUTE AFTER UPDATE LOGIC
        System.debug('SAFELITE_DEBUG:TaskTriggerHandler:OnAfterUpdate:: updatedObjects=' + updatedObjects);
        updateAccountActivityFields(updatedObjects);
    }
    

     public void updateAccountActivityFields(Task[] taskRecords){
        /* when a task of RecordType(Safelite_Task_Record_Type) is created/updated either from Account or Contact then 
        update Account fields : Last_Face_to_Face_Activity__c, Last_Visited_By__c & Last_Call_Activity__c based on task type
        */
        System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: taskRecords=' + taskRecords);

        // find task record type 
        RecordType taskRec = [SELECT Id FROM RecordType WHERE SobjectType ='Task' AND DeveloperName ='Safelite_Task_Record_Type'];
        System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: taskRec.Id=' + taskRec.Id);
        
        List<Account> accountsToUpdate = new List<Account>();
        Account a;
         
        //Map of Account IDs and Accounts
        Map<id,account> accMap = new Map<id,account>();
       
        //Get all the contactIds and accountIds of the task being inserted/updated
        for(Task tk : [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, whoid, whatid FROM task WHERE id in :taskRecords]){
            if(tk.RecordTypeId == taskRec.Id  && tk.Whoid!=null){
                
                a = new Account(Id = [SELECT AccountId FROM Contact  WHERE Id =: tk.WhoId LIMIT 100].AccountId);
                              
                System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: tk.WhatId=' + tk.WhatId);
                
                //convert task's CreatedDate, datetime to date
                Date createdDateJustDate = date.newinstance(tk.CreatedDate.year(), tk.CreatedDate.month(), tk.CreatedDate.day());
                System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: createdDateJustDate=' + createdDateJustDate);
                
                //update the activity fields on account with Task's lastModifiedDate and LastModifiedBy based on Task Type
                if(tk.type=='Face 2 Face Meeting' || tk.type=='Lunch'){
                    a.Last_Face_to_Face_Activity__c = createdDateJustDate;
                    a.Last_Visited_By__c = tk.LastModifiedBy.name;
                    accountsToUpdate.add(a);
                    System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: Last_Face_to_Face_Activity__c=' + a.Last_Face_to_Face_Activity__c);
                    System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: Last_Visited_By__c=' + a.Last_Visited_By__c);
                }
                else{
                    a.Last_Call_Activity__c =  createdDateJustDate;
                    accountsToUpdate.add(a);
                    System.debug('SAFELITE_DEBUG:TaskTriggerHandler:updateAccountActivityFields:: Last_Call_Activity__c=' + a.Last_Call_Activity__c);
                }
                //Populate accMap with the Account IDs and Account record
                accMap.put(a.id,a);
               
            }
        }
        
         if(!accMap.isEmpty()){
            Update accMap.values();
        }
            
    }
}

My Test Class:
 static testMethod void testAdminUserwithTask() {
        
        // Next make sure that a System Admin *can* delete an attachment
        Profile adminProf = [select id from profile where name='System Administrator']; 
        User au = new User(alias = 'Admint', email='AdminUser@asdahsdjkhkjashdjasd.com',emailencodingkey='UTF-8',FirstName='Admin',
                           lastname='task',languagelocalekey='en_US',localesidkey='en_US',profileid = adminProf.Id,
                           timezonesidkey='America/Los_Angeles',username='AdminUser@asdahsdjkhkjashdjasd.com');
        // Switch current user to System Admin user
        System.runAs(au) {
            // Create test data (a new Account with an Attachment)
            Account a = new Account(Name='Testtasking');
            insert a;
            Contact con = new Contact(LastName='Test',FirstName='asdasd',Email='asdasd@adsasd.com') ;
            insert con ; 
            List<Task> tasks = new List<Task>{};
                for(Integer i = 0; i < 200; i++) 
            {
                Task t = new Task(Subject='Donni'+i,Status='New',Priority='Normal',Type='Phone Call', whoId =con.Id, whatId = a.Id );
                tasks.add(t);
            }
            test.startTest();
            insert tasks;
            test.stopTest();
            
            try {
                delete tasks;
            } catch (Exception e) {
                
            }
            
        }
    }
 

Hi All,

I have trigger on after insert and after update, below is my handler class.

If i create a task from contact(is a required field on page layout) it fails because whatID is null. So I'm trying to query to get the whatID based on whoID.

If i create a task from account, works fine because whoid and whatid are not null.

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    
    public TaskTriggerHandler(){
        
    }
    
    public void OnAfterInsert(Task[] newObjects){
        // EXECUTE AFTER INSERT LOGIC       updateAccountActivityFields(newObjects);
    }
    
    public void OnAfterUpdate(Task[] oldObjects, Task[] updatedObjects, Map<ID, Task> ObjectMap){
        //EXECUTE AFTER UPDATE LOGIC
        updateAccountActivityFields(updatedObjects);
    }
    

     public void updateAccountActivityFields(Task[] taskRecords){
      
        // find task record type 
        RecordType taskRec = [SELECT Id FROM RecordType WHERE SobjectType ='Task' AND DeveloperName ='Task_Record_Type'];
        
        List<Account> accountsToUpdate = new List<Account>();
        Account a;
       
        //Get all the contactIds and accountIds of the task being inserted/updated
        for(Task tk : [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, whoid, whatid FROM task WHERE id in :taskRecords]){
            if(tk.RecordTypeId == taskRec.Id  && tk.Whoid!=null){
                
                // query to get account ID from contact:whoID 
                a = new Account(Id = [SELECT AccountId FROM Contact WHERE Id =: tk.WhoId]);
                              
                //convert task's CreatedDate, datetime to date
                Date createdDateJustDate = date.newinstance(tk.CreatedDate.year(), tk.CreatedDate.month(), tk.CreatedDate.day());
        
                //update the activity fields on account with Task's lastModifiedDate and LastModifiedBy based on Task Type
                if(tk.type=='Face 2 Face Meeting' || tk.type=='Lunch'){
                    a.Last_Face_to_Face_Activity__c = createdDateJustDate;
                    a.Last_Visited_By__c = tk.LastModifiedBy.name;
      
                }
                else{
                    a.Last_Call_Activity__c =  createdDateJustDate;
                    
                }
                
                accountsToUpdate.add(a);
               
            }
        }
        
       if(!accountsToUpdate.isEmpty())
            Update accountsToUpdate;

Please help!!

Hi all,

I need help on test class, this is my class:

When creating a task of type (Phone Call or Last Face to Face) from contact,need to update the account fields

I have a trigger:
trigger TaskTrigger on Task (after delete, after insert, after undelete, after update, before delete, before insert, before update) {
    
    TaskTriggerHandler handler = new TaskTriggerHandler (Trigger.isExecuting, Trigger.size);
    //After Update
     if(Trigger.isUpdate && Trigger.isAfter){
         handler.OnAfterUpdate(Trigger.new,Trigger.oldMap);
          
   }
 }

TriggerHandler class:

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    private integer batchSize = 0;
    
    public TaskTriggerHandler ( boolean isExecuting, integer size){
        trigger_isExecuting = isExecuting;
        batchSize = size;        
    }

    public void OnAfterUpdate(List<Task> Tklist, Map<id,Task> OldMaplst){
        //EXECUTE AFTER UPDATE LOGIC
        //first condition is to check the record type then 
         Set<ID> tid = new Set<ID>();
         list<Account> acclst = new list<Account>();
        
        for(Task tk:Tklist){
        if(tk.Whoid!=null && tk.WhoId.getSObjectType().getDescribe().getName()=='Contact'){
         tid.add(tk.whoid);
            }
          }
        List<Contact> con = new List<Contact>();
        con=[select id,accountid from Contact where id =:tid];
        Map<id,account>Lstacc=new Map<id,account>();
        if(!con.isEmpty()){
            account acc;
            for(Task tk:[select id,LastModifiedBy.name,type,LastModifiedDate from task where id in :Tklist]){
                DateTime dt = tk.LastModifiedDate;
                Date myDate = date.newinstance(dt.year(), dt.month(), dt.day());
                acc=new account(id=con[0].accountid);
                    if(tk.type=='Face 2 Face Meeting'){
                        acc.Last_Face_to_Face_Activity__c= myDate;
                        acc.Last_Visited_By__c =tk.LastModifiedBy.name;
                        
                    }
                    else if(tk.type=='Phone Call'){
                     acc.Last_Call_Activity__c =  myDate;
                    }
                     Lstacc.put(acc.id,acc);
        }
                if(!Lstacc.isEmpty())
                    Update Lstacc.values();

    }
  }
}
Hi Folks,

I'm getting the following error:

Apex trigger TaskTrigger caused an unexpected exception, contact your administrator: TaskTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 0010c00001zZtfnAAC; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []: ()

I have a trigger on Task and apex handler class which executes on after insert and after  update.

When a user logs a call either from account and contact(which have lookup relationship) then custom fields on account should get updated.

This works fine with sys admin credential but when i login and test as  a specific profile user. They get the error, the field is editable and apex class is enabled account has read, write and edit permission but not view all or modify all.

Can I make this code gets executed for any user and any profile meaning as a sys admin, How can I do this?
Hi all,
I'm trying to get the account ID's from contact(lookup realtionship not Master detail).

 public void updateAccountActivityFields(Task[] taskRecords){
 Set<String> conIDs = new Set<String>();
 for(Task t : taskRecords){
            conIDs.add(t.WhoID);
        } 
//query outside forloop
//Account and contact have lookup relationship
 Map<Id,Contact> conmap = new Map<Id,Contact>([SELECT AccountId FROM Contact WHERE Id IN :conIDs]);

//returns NO value for accountsToUpdate, But When I debug only for conmap.keyset() I see the account ID..need help!!
List<Account> accountsToUpdate = [SELECT Id FROM Account WHERE Id IN :conmap.keyset()];
            
 for(Task t: [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, WhoID, WhatID FROM task WHERE id in :taskRecords]){
for(Account a : accountsToUpdate){
//Logic here
}
}
I have a trigger on TASK and handler class which is on After Insert and After Update, updates custom fields on account.

for Task - contact (whoId) is required field.
when a user logs a call from contact, he may not enter the WhatID(Account). So i'm trying to query and get the WhatId from WhoId of a task adn also trying to Bulkify Code.

HandlerClass:

 public void updateAccountActivityFields(Task[] taskRecords){
 Set<String> conIDs = new Set<String>();
 for(Task t : taskRecords){
            conIDs.add(t.WhoID);
        } 
//query outside forloop
//Account and contact have lookup relationship
 List<Contact> accIDs = [SELECT AccountId FROM Contact WHERE Id IN :conIDs];

//getting ERROR at this line 
List<Account> accountsToUpdate = [SELECT Id FROM Account WHERE Id IN :accIDs];

 for(Task t: [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, WhoID, WhatID FROM task WHERE id in :taskRecords]){
for(Account a : accountsToUpdate){
//Logic here
}
}
}

 

Hi All,

I have trigger on after insert and after update, below is my handler class.

If i create a task from contact(is a required field on page layout) it fails because whatID is null. So I'm trying to query to get the whatID based on whoID.

If i create a task from account, works fine because whoid and whatid are not null.

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    
    public TaskTriggerHandler(){
        
    }
    
    public void OnAfterInsert(Task[] newObjects){
        // EXECUTE AFTER INSERT LOGIC       updateAccountActivityFields(newObjects);
    }
    
    public void OnAfterUpdate(Task[] oldObjects, Task[] updatedObjects, Map<ID, Task> ObjectMap){
        //EXECUTE AFTER UPDATE LOGIC
        updateAccountActivityFields(updatedObjects);
    }
    

     public void updateAccountActivityFields(Task[] taskRecords){
      
        // find task record type 
        RecordType taskRec = [SELECT Id FROM RecordType WHERE SobjectType ='Task' AND DeveloperName ='Task_Record_Type'];
        
        List<Account> accountsToUpdate = new List<Account>();
        Account a;
       
        //Get all the contactIds and accountIds of the task being inserted/updated
        for(Task tk : [SELECT Id, LastModifiedBy.name, type, LastModifiedDate, CreatedDate, RecordTypeId, whoid, whatid FROM task WHERE id in :taskRecords]){
            if(tk.RecordTypeId == taskRec.Id  && tk.Whoid!=null){
                
                // query to get account ID from contact:whoID 
                a = new Account(Id = [SELECT AccountId FROM Contact WHERE Id =: tk.WhoId]);
                              
                //convert task's CreatedDate, datetime to date
                Date createdDateJustDate = date.newinstance(tk.CreatedDate.year(), tk.CreatedDate.month(), tk.CreatedDate.day());
        
                //update the activity fields on account with Task's lastModifiedDate and LastModifiedBy based on Task Type
                if(tk.type=='Face 2 Face Meeting' || tk.type=='Lunch'){
                    a.Last_Face_to_Face_Activity__c = createdDateJustDate;
                    a.Last_Visited_By__c = tk.LastModifiedBy.name;
      
                }
                else{
                    a.Last_Call_Activity__c =  createdDateJustDate;
                    
                }
                
                accountsToUpdate.add(a);
               
            }
        }
        
       if(!accountsToUpdate.isEmpty())
            Update accountsToUpdate;

Please help!!

Hi all,

I need help on test class, this is my class:

When creating a task of type (Phone Call or Last Face to Face) from contact,need to update the account fields

I have a trigger:
trigger TaskTrigger on Task (after delete, after insert, after undelete, after update, before delete, before insert, before update) {
    
    TaskTriggerHandler handler = new TaskTriggerHandler (Trigger.isExecuting, Trigger.size);
    //After Update
     if(Trigger.isUpdate && Trigger.isAfter){
         handler.OnAfterUpdate(Trigger.new,Trigger.oldMap);
          
   }
 }

TriggerHandler class:

public with sharing class TaskTriggerHandler {
    
    private boolean trigger_isExecuting = false;
    private integer batchSize = 0;
    
    public TaskTriggerHandler ( boolean isExecuting, integer size){
        trigger_isExecuting = isExecuting;
        batchSize = size;        
    }

    public void OnAfterUpdate(List<Task> Tklist, Map<id,Task> OldMaplst){
        //EXECUTE AFTER UPDATE LOGIC
        //first condition is to check the record type then 
         Set<ID> tid = new Set<ID>();
         list<Account> acclst = new list<Account>();
        
        for(Task tk:Tklist){
        if(tk.Whoid!=null && tk.WhoId.getSObjectType().getDescribe().getName()=='Contact'){
         tid.add(tk.whoid);
            }
          }
        List<Contact> con = new List<Contact>();
        con=[select id,accountid from Contact where id =:tid];
        Map<id,account>Lstacc=new Map<id,account>();
        if(!con.isEmpty()){
            account acc;
            for(Task tk:[select id,LastModifiedBy.name,type,LastModifiedDate from task where id in :Tklist]){
                DateTime dt = tk.LastModifiedDate;
                Date myDate = date.newinstance(dt.year(), dt.month(), dt.day());
                acc=new account(id=con[0].accountid);
                    if(tk.type=='Face 2 Face Meeting'){
                        acc.Last_Face_to_Face_Activity__c= myDate;
                        acc.Last_Visited_By__c =tk.LastModifiedBy.name;
                        
                    }
                    else if(tk.type=='Phone Call'){
                     acc.Last_Call_Activity__c =  myDate;
                    }
                     Lstacc.put(acc.id,acc);
        }
                if(!Lstacc.isEmpty())
                    Update Lstacc.values();

    }
  }
}