• Vidhyasagar Ranganathan
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hi All,

Below is the trigger I got in one of the forums that I modified and works fine. What the trigger does is copies the final approval comment in the approval process and populates in a custom field. Now the requirement is to have comments from all the approval steps to be populated in that custom field including the Approver Name and the Step. 

Thank you

trigger TriggerApprover on zqu__Quote__c (before update) {
    
       if(trigger.isUpdate){
             List<zqu__Quote__c> QuoList =  [Select id,
                                                   (Select  
                                                         ActorId, 
                                                         Comments                                                      
                                                    FROM ProcessSteps
                                                ORDER BY CreatedDate DESC) 
                                                    From zqu__Quote__c
                                                WHERE Id IN : Trigger.new];

             if(QuoList.size() > 0){

               for(zqu__Quote__c Quo : QuoList){
              
                for(zqu__Quote__c Quo1 : Trigger.new) {
                  
                         if(Quo.id == Quo1.id && Quo1.copy_comment__c) {
 
                           if (Quo.ProcessSteps.size() > 0) {
                            
                         Quo1.Approver_Comment__c = Quo.ProcessSteps[0].Comments;
                         Quo1.copy_comment__c = false;
                
                           }

                        }
                 
                    }
               }
             }   
        }  
    }
Hi All,

I am looking for some help for an one off apex class that would update the opportunity details in custom object. The custom object has the opportunity ID.

Thank you.
Hi All,

I am looking for some help in writing a trigger that upon Opportunity creation (either from lead conversion or later) will get the contact ID from contact role and match that with the contact ID in the custom object to get Opportunity ID and update the custom object with opportunity fields.

Thanks!
 
Hi All,

I am looking for a trigger on Lead that upon lead conversion would update a custom object (CAT) with two fields. The custom object already has Lead ID's. The trigger would need to find the lead ID's in the custom object and update values of two fields from lead object.

Any help is appreciated greatly !

Thanks
Hello,

I am trying to create a trigger that will update the custom object records once records are created in the object. The custom object has ID from Lead Object and with that I will have to pull 5 fields of that lead and update in the custom object.

I started with the trigger but couldn't proceed and any help is appreciated

Thanks

trigger CampaignAttributionGetLead2 on Campaign_Attribution__c (before insert, before update) {
    for (Campaign_Attribution__C C: Trigger.new){
        if(C.Lead_ID__C != null)
        {
            List<Lead> L = [SELECT createddate, name, company, status, Lead_Medium__c FROM lead where ID = :C.Lead_ID__c] ;            
            {
                C.Lead_Created_Date__c = L.createddate;
                C.Lead_Medium__c = L.Lead_Medium__c;
                C.Lead_Status__C = L.Status;
                C.Lead_Name__C = L.name;
                C.Lead_Company__C = L.company;
            }
        }            
    }
    update C;
}
Hi All,

Below is the trigger I got in one of the forums that I modified and works fine. What the trigger does is copies the final approval comment in the approval process and populates in a custom field. Now the requirement is to have comments from all the approval steps to be populated in that custom field including the Approver Name and the Step. 

Thank you

trigger TriggerApprover on zqu__Quote__c (before update) {
    
       if(trigger.isUpdate){
             List<zqu__Quote__c> QuoList =  [Select id,
                                                   (Select  
                                                         ActorId, 
                                                         Comments                                                      
                                                    FROM ProcessSteps
                                                ORDER BY CreatedDate DESC) 
                                                    From zqu__Quote__c
                                                WHERE Id IN : Trigger.new];

             if(QuoList.size() > 0){

               for(zqu__Quote__c Quo : QuoList){
              
                for(zqu__Quote__c Quo1 : Trigger.new) {
                  
                         if(Quo.id == Quo1.id && Quo1.copy_comment__c) {
 
                           if (Quo.ProcessSteps.size() > 0) {
                            
                         Quo1.Approver_Comment__c = Quo.ProcessSteps[0].Comments;
                         Quo1.copy_comment__c = false;
                
                           }

                        }
                 
                    }
               }
             }   
        }  
    }
Hello,

I am trying to create a trigger that will update the custom object records once records are created in the object. The custom object has ID from Lead Object and with that I will have to pull 5 fields of that lead and update in the custom object.

I started with the trigger but couldn't proceed and any help is appreciated

Thanks

trigger CampaignAttributionGetLead2 on Campaign_Attribution__c (before insert, before update) {
    for (Campaign_Attribution__C C: Trigger.new){
        if(C.Lead_ID__C != null)
        {
            List<Lead> L = [SELECT createddate, name, company, status, Lead_Medium__c FROM lead where ID = :C.Lead_ID__c] ;            
            {
                C.Lead_Created_Date__c = L.createddate;
                C.Lead_Medium__c = L.Lead_Medium__c;
                C.Lead_Status__C = L.Status;
                C.Lead_Name__C = L.name;
                C.Lead_Company__C = L.company;
            }
        }            
    }
    update C;
}
Can anyone assist me on how to create a trigger to upate the Task record type to reflect the same as the Parent Record type? For instance, if the Lead or Opporunity record type is "TEST RECORD TYPE" then Task record type is updated as the same "TEST RECORD TYPE". Thanks.