Skip to main content
EST Export (salesforce) a posé une question dans #Apex
public class  customerUpdate {

public  void updatecustomer(){

        Set<Id> ParentIds = New Set<Id>();

        for(customer__c newissuer :(List< customer__c>) Trigger.New)

        {

            if(newissuer.Id != null)

                ParentIds.add(newissuer.Id);

        }

        List<customer__c> ParentList = [SELECT Id, Name,Status__c, RevQ0__c, RevQ1__c, RevQ2__c, RevQ3__c, RevQ4__c 

                                FROM customer__c where id =: ParentIds];

         For(customer__c CO : ParentList)    

        {

            system.debug('ParentList12'+co.id);

            system.debug('ParentList123'+co.Status__c);

            for(customer__c rc :(List<customer__c>) Trigger.New){

         if(rc.Status__c=='Approved'){

                   rc.RevQ1__c= CO.RevQ0__c;

                   rc.RevQ0__c = null;

                    rc.RevQ2__c= CO.RevQ1__c;

                    rc.RevQ3__c= CO.RevQ2__c;

                    rc.RevQ4__c= CO.RevQ3__c;

                    

                 

                }

            }

            

        }    

    }

    

}
1 réponse
  1. 27 janv. 2020, 05:05
    Hi junkiy,

      

    Use this code this will help you.

    Apex Class:

    @isTest

    public class customerUpdateTest{

    @isTest

    private static void testMethod1(){

    customer__c cstmer = new customer__c();

    cstmer.Status__c = 'Approved';

    insert cstmer;

    }

    }

    If you found it useful please appreciate my efforts and mark it as the best answer.

    LinkedIn:  https://www.linkedin.com/in/soyab-hussain-b380b1194/

    Regards,

    Soyab