• Parantap Srivastav
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I have a visualforce page that shows my tasks subject as a datatable column. I  have a link  - 

<a class="editIcon" href="/{!task.Id}/e?&tsk12=Completed" style="float:right;">
    <img src="{!URLFOR($Resource.Images, '/Edit40.png')}" style="width: 18px;       margin-left: 6px;margin-top:-2x"/>
 </a>

next to the subject on every row which opens up the standard task (detail) page as a modal. Now after I complete editing my task and click save button, I get my vf page back but the task changes are not reflected in the table, They are visible only after I reload the table. How do I reload my table on clicking the save button in the modal? Images are attached.This is the datable with Task Name as the task subject and pencil icon as the link to the detail page modal.This is the edit page that opens up on the click of the pencil icon(link). I want to reload my datatable by clicking the save button on this modal.
Here is my code: 
trigger TrigUpAcc on Contact (after insert,after update) 
{
    System.debug('Trigger.New has: '+Trigger.New); //to see the trigger.New records 
    List<Id> accIdL = new List<id>();
    integer i = 0;
    for(Contact c : Trigger.new)
    {
        if (c.AccountId != null)
        {
            System.debug('The loop is running '+ i +'times'); // to count the records in Trigger.New 
            accIdL.add(c.AccountId);
            i++;
            System.debug('The contact is: '+c); // To get the contact
        }
    }
    
    System.debug('size of the id list is: '+accIdL.size()); //just another check of the record list
    
    List<Contact> lstConUpdate = new List<Contact>();
    List<Account> accL = [Select Id, Name,(Select LastName From Contacts)  From Account WHERE Id in :accIdL];
    System.debug('Size of accL is :  ' +accL.size()); 
    for(Account acc : accL)
    {
        string accName = ''; 
        for(Contact c : acc.Contacts)
        {
            accName = acc.name + c.LastName; 
            acc.Name = accName;
            lstConUpdate.add(c);
            
        }
        
    }
    if(lstConUpdate.size() > 0)
    {
        Update lstConUpdate;   
    }
    
}
The code runs but does not make the required changes. making the debugging shows that all records in trigger,new are not being accessed. Kinldy help me out, I am stuck here.




 
Here is my code: 
trigger TrigUpAcc on Contact (after insert,after update) 
{
    System.debug('Trigger.New has: '+Trigger.New); //to see the trigger.New records 
    List<Id> accIdL = new List<id>();
    integer i = 0;
    for(Contact c : Trigger.new)
    {
        if (c.AccountId != null)
        {
            System.debug('The loop is running '+ i +'times'); // to count the records in Trigger.New 
            accIdL.add(c.AccountId);
            i++;
            System.debug('The contact is: '+c); // To get the contact
        }
    }
    
    System.debug('size of the id list is: '+accIdL.size()); //just another check of the record list
    
    List<Contact> lstConUpdate = new List<Contact>();
    List<Account> accL = [Select Id, Name,(Select LastName From Contacts)  From Account WHERE Id in :accIdL];
    System.debug('Size of accL is :  ' +accL.size()); 
    for(Account acc : accL)
    {
        string accName = ''; 
        for(Contact c : acc.Contacts)
        {
            accName = acc.name + c.LastName; 
            acc.Name = accName;
            lstConUpdate.add(c);
            
        }
        
    }
    if(lstConUpdate.size() > 0)
    {
        Update lstConUpdate;   
    }
    
}
The code runs but does not make the required changes. making the debugging shows that all records in trigger,new are not being accessed. Kinldy help me out, I am stuck here.




 
Lighnting component javascript controller:
 deleteRecord : function(component,event,helper,recordId){
        var action = component.get("c.deleteSelRecord");
        action.setParams({"recordId":recordId});
        action.setCallback(this,function(response){
            var state = response.getState();
            if(state === "SUCCESS"){
                var result = response.getReturnValue();
                //if(result ==="true"){
                    // toast message
                    alert("Requested Record Deleted");
                component.set("v.isOpen", false);
               // }
                console.log(" result :: "+JSON.stringify(result));
                
            }else{
                console.log(" Error Occured");
            }
            
        });
        $A.enqueueAction(action);
        
    }
    
    
Apex controller:
  @AuraEnabled
    public static list<Quote> deleteSelRecord(String recordId){
       // boolean result = true;
        // if successs return true;
      //  return result;
       System.debug('Quote got deleted');  
       List<quote> quotess = new List<quote>();
       quotess= [Select Id, Name, QuoteNumber,Status,OpportunityId FROM quote where Id =:recordId ORDER BY QuoteNumber ];
       if(quotess.size() > 0){
            try{
                delete quotess;
           }catch(Exception e){
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Exception: '+e);
                ApexPages.addMessage(myMsg);   
                return quotess;                          
          }                       
    }