• Ashok0572
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies
The below is uncovered Code,can anyone help me
if(lstUser != null && lstUser.size() > 0){
                    for(User user : lstUser){
                        if(mapOwnerLeadIds.containsKey(user.id) && mapOwnerLeadIds.get(user.id) != null ){
                            for(id ids : mapOwnerLeadIds.get(user.id)){
                                Task objTask=new Task();
                                objTask.WhoId=ids;
                                objTask.Subject='Sales User did not updated the lead since 7 days.';
                                objTask.OwnerId=user.ManagerId;
                                objTask.Priority='Normal';
                                objTask.status='Not Started';
                                lstTask.add(objTask);
                            }

====================================================
@isTest
private class LeadTriggerTest {

    static testMethod void myUnitTest() {
        
        TestDataHelper.profileName='Fujitsu Telemarketing Agency';
        User systemAdministrator = (User)TestDataHelper.createSObject('User');
        system.debug('chcking --> '+ systemAdministrator.Alias);
        systemAdministrator.Alias = 'userabc';
        insert systemAdministrator;
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        list<Account> lstAccount=(list<Account>)TestDataHelper.createSObjectList(Constant.accountObject,false,4);
        system.assertEquals(4, lstAccount.size());
        //lstAccount[0].Sales_Channel__c='Directly Managed';
        //lstAccount[1].Sales_Channel__c='Channel Managed';
        lstAccount[1].Partner__c=true;
        lstAccount[1].eMail_Address__c = 'my@email.com';
        lstAccount[1].Website = 'myWeb.site';
        
        lstAccount[2].Account_Segment__c= 'Accounts';
        lstAccount[3].Account_Segment__c= 'Accounts';
        
        insert lstAccount;
     
        List<Organization__c> lstOrganization = (List<Organization__c>)TestDataHelper.createSObjectList(Constant.organizationObject,false,4); 
        insert lstOrganization;
        system.assertEquals(4, lstOrganization.size() );
        
        List<OrganizationUser__c> lstOrgUser = (List<OrganizationUser__c>)TestDataHelper.createSObjectList(Constant.organizationUserObject,false,4);
        system.assertEquals(4, lstOrgUser.size() );
        for(integer i=0;i<lstOrgUser.size() ;i++){
            lstOrgUser[i].Organization__c=lstOrganization[i].id;
            lstOrgUser[i].User__c=systemAdministrator.id;
        }
        insert lstOrgUser;
        
        list<Lead> lstLead=(list<Lead>)TestDataHelper.createSObjectList('Lead',false,6);
        for(integer i=0;i<lstLead.size()-2;i++)
        {
            lstLead[i].Organization__c=null;
            lstLead[i].Account__c=lstAccount[i].id;
            lstLead[i].Status ='Qualified';
            lstLead[i].Country='India';
            lstLead[i].Company='Fujitsu';
         //   lstLead[i].CompanyDunsNumber='12345';
            
        }
        lstLead[4].Account__c= null;
        lstLead[4].Country= 'India';
        lstLead[5].Account__c= null;      
        lstLead[5].Company= 'Fujitsu';
                    
        
        List<AccountTeamMember> lstAccTeamMember=(List<AccountTeamMember>)TestDataHelper.createSObjectList(Constant.accTeamMemberObject,false,4); 
        for(integer i=0;i<lstAccTeamMember.size() ;i++) {
            lstAccTeamMember[i].UserId=systemAdministrator.id;
            lstAccTeamMember[i].AccountId=lstAccount[i].id;
            lstAccTeamMember[i].TeamMemberRole ='Account Manager';
        }
        lstAccTeamMember[1].TeamMemberRole='Partner Manager (PAM)';  
        insert lstAccTeamMember;
        
        List<Organization_Field_Id__c> lstOrgFieldIds=TestDataHelper.getOrganizationFieldIds();
        insert lstOrgFieldIds;
        System.debug('lstOrgFieldIds::>>'+ lstOrgFieldIds);
        
        Test.startTest();   
            for(integer i = 0 ; i<lstLead.size() ; i++)
            {
                lstLead[i].CompanyDunsNumber = '12345';
            }               
            system.debug('lstLead --> '+lstLead);        
            insert lstLead;
            System.debug('Lead ::>>'+ lstLead);
            System.debug('Lead Insert ::>>'+ [Select Id, ownerid from Lead]);       
           
            for(integer i=0;i<lstLead.size()-3;i++){
                lstLead[i].Organization__c  = lstOrganization[i].id;
               // lstLead[i].CompanyDunsNumber= '123456' ;
                lstLead[i].IsModifiedCheck__c = true;
            }            
            try {               
                update lstLead;         
                System.debug('Lead Update::>>'+ lstLead);   
             }
             catch(Exception e) {               
             }             
        Test.stopTest();        
    }
    
    static testMethod void myUnitTest1() {
        TestDataHelper.profileName='Fujitsu Telemarketing Agency';
        User systemAdministrator = (User)TestDataHelper.createSObject('User');
        
        systemAdministrator.Alias = 'userabc';
        insert systemAdministrator;
        
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        List<Account> lstAccountObject=(List<Account>)TestDataHelper.createSObjectList(Constant.accountObject,false,2);
        //lstAccountObject[0].Sales_Channel__c='Channel Managed';
        lstAccountObject[0].Partner__c=true;
        lstAccountObject[0].eMail_Address__c = 'my@email.com';
        lstAccountObject[0].Website = 'myWeb.site';
        lstAccountObject[1].Account_Segment__c='Aquisition';
        insert lstAccountObject;
        
        
        User us=new User();
        Task objTask=new Task();
        
        objTask.WhoId=us.id;
        objTask.Subject='Sales User ';
        objTask.OwnerId='85858964';
        objTask.Priority='Normal';
        objTask.status='Not Started';
       
        insert objTask;
        
        Organization__c organizationObject = (Organization__c)TestDataHelper.createSObject(Constant.organizationObject); 
        insert organizationObject;
        
        List<OrganizationUser__c> lstOrgUser = (List<OrganizationUser__c>)TestDataHelper.createSObjectList(Constant.organizationUserObject,false,1);
        system.assertEquals(1, lstOrgUser.size() );
        for(integer i=0;i<lstOrgUser.size() ;i++){
            lstOrgUser[i].Organization__c=organizationObject.id;
            lstOrgUser[i].User__c=systemAdministrator.id;
        }
        insert lstOrgUser;
        
        List<Lead> lstLeadObject=(List<Lead>)TestDataHelper.createSObjectList(Constant.leadObject,false,2);
        for(integer i=0;i < lstLeadObject.size(); i++){
            lstLeadObject[i].Status ='Qualified';
            lstLeadObject[i].OwnerId=systemAdministrator.id;
            lstLeadObject[i].Account__c=lstAccountObject[i].id;
            lstLeadObject[i].CompanyDunsNumber = '12345' ;
        }
        
        
        list<AccountTeamMember> lstAccTeamMemberObject=(list<AccountTeamMember>)TestDataHelper.createSObjectList(Constant.accTeamMemberObject,false,2); 
        for(integer i=0;i<lstAccTeamMemberObject.size();i++){
            lstAccTeamMemberObject[i].UserId=systemAdministrator.id;
            lstAccTeamMemberObject[i].AccountId=lstAccountObject[i].id;
            
        }
        lstAccTeamMemberObject[0].TeamMemberRole ='Partner Manager (PAM)';
        lstAccTeamMemberObject[1].TeamMemberRole ='Account Manager';
        
        insert lstAccTeamMemberObject;
        
        Test.startTest();
            insert lstLeadObject;
        Test.stopTest();
        
    }
    
}
DeleteQuoteLineItemCTLRTest.myUnitTest -- System.DmlException: Insert failed. First exception on row 0; 

first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Quote Account and the Opportunity Account must be insync: [Account__c]

    Stack trace: Class.DeleteQuoteLineItemCTLRTest.myUnitTest: line 58, column 1



==========================================================

@isTest
private class DeleteQuoteLineItemCTLRTest {

    static testMethod void myUnitTest() {
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        Account accObj = (Account) TestDataHelper.createSObject('Account');
        accObj.BillingCountry = 'Germany';
        insert accObj;
        
        AccountContactRole accountContactRole=(AccountContactRole)TestDataHelper.createSObject('AccountContactRole',true,1);
        Opportunity oppty=(Opportunity)TestDataHelper.createSObject('Opportunity');
        oppty.accountId=AccountContactRole.AccountId;
        accountContactRole.IsPrimary=true;
        insert accountContactRole;
        insert oppty;
        
        system.assertequals(oppty.accountid,accountContactRole.AccountId);
        Quote quote = (Quote)TestDataHelper.createSObject('Quote');
        quote.opportunityId=oppty.id;
        quote.Sold_To__c = accobj.Id;
        //quote.Account__c= accObj.Id;
        //quote.Account__c = accObj.Id;
        insert quote;
        
        
        system.assertequals(quote.OpportunityId,oppty.id);
        list<QuoteFieldIds__c> quoteFields=TestDataHelper.getQuoteFieldIds();
        insert quoteFields;
        
        system.Test.setCurrentPage(Page.AppendSaveURLQLI);
        
         Test.startTest();
            // Run as System Administrator
            //system.runAs(systemAdministrator){ 
                //runDeleteQuoteCTLR(quote);
                ApexPages.currentPage().getParameters().put('newid',quote.id);
                ApexPages.currentPage().getParameters().put('oppid',oppty.id);
                runDeleteQuoteCTLR(quote);
                system.assertequals(ApexPages.currentPage().getParameters().get('newid'),quote.id);
                system.assertequals(ApexPages.currentPage().getParameters().get('oppid'),oppty.id);
                //ApexPages.currentPage().getParameters().put('save_new','Https://login.salesforce.com?id=test');
                //runDeleteQuoteCTLR(quote);
            //}
            
        Test.stopTest();
    }
    static void runDeleteQuoteCTLR(Quote quote){
        ApexPages.Standardcontroller controller=new ApexPages.Standardcontroller(quote);
        DeleteQuoteLineItemCTLR deleteQLICTLR=new DeleteQuoteLineItemCTLR(controller);
        deleteQLICTLR.deleteQLI();
        deleteQLICTLR.appendSaveURL();
    }
}
The below is action method in Controller
Sold_To__c {Lookup(Account)} & Channel_Partner__c {Lookup(Account)} are 2 fields and i need to get predefault Sold_To__c ,Channel_Partner__c values


public PageReference appendSaveURL()
   {
        PageReference pageRef;
        String tempURL = String.valueof(ApexPages.currentPage());
        system.debug('****tempURL***'+tempURL);
        string finalURL = URL.getSalesforceBaseUrl().toExternalForm() + (URL.getSalesforceBaseUrl().toExternalForm().contains('visual.force') ? '' : '/partner') +'/0Q0/e';
        //string finalURL = '/0Q0/e';
        if(tempURL.contains('?'))
        {  try
            {
            tempURL = tempURL.replace('?','!@#');
            String[] paramArray = tempURL.split('!@#');
            String saveURL = paramArray[1];
            system.debug('*****saveURL****'+saveURL);
            if(tempURL.contains('save_new'))
            {
                String[] tempArray = saveURL.split('save_new');
                for(integer i=0;i<tempArray.size();i++)
                    finalURL = finalURL +'?'+tempArray[i];
                finalURL = finalURL +'&nooverride=1&saveURL=' + (URL.getSalesforceBaseUrl().toExternalForm().contains('visual.force') ? '' : '/partner') + '/apex/DeleteQuoteLineItems';
            }
            else
                finalURL = finalURL +'?'+saveURL+'&nooverride=1&saveURL='+ (URL.getSalesforceBaseUrl().toExternalForm().contains('visual.force') ? '' : '/partner') + '/apex/DeleteQuoteLineItems';
            }
            catch(exception ex)
            {
                finalURL = finalURL +'?nooverride=1&saveURL='+ (URL.getSalesforceBaseUrl().toExternalForm().contains('visual.force') ? '' : '/partner') + '/apex/DeleteQuoteLineItems';
            }
        }
        else
        {
            finalURL = finalURL +'?nooverride=1&saveURL='+ (URL.getSalesforceBaseUrl().toExternalForm().contains('visual.force') ? '' : '/partner') + '/apex/DeleteQuoteLineItems';
        }
        system.debug('****finalURL****'+finalURL );
        Map<String,QuoteFieldIds__c> quoteIds = QuoteFieldIds__c.getAll(); // Custom Setting to store the Field id of Contact
        String accountId = 'CF';
        if(quoteIds != null && quoteIds.size() > 0 && quoteIds.containsKey('ContactName')){
            string contactId=quoteIds.get('ContactName').Field_Id__c;
           
            //get Primary AccountContactRole of Quote's Opportunity
            list<AccountContactRole> lstAccountCR=[SELECT ContactId,contact.name FROM AccountContactRole where IsPrimary=true and accountid in (select  accountid from opportunity where id =:ApexPages.currentPage().getParameters().get('oppid'))];
            if(lstAccountCR != null && lstAccountCR.size() > 0){
                finalURL=finalURL + '&' + contactId + '=' + lstAccountCR[0].contact.name + '&' + contactId + '_lkid=' + lstAccountCR[0].ContactId; 
            }
        }
        
        //code Added by Dilip ape TA577 on date 06/04/2014
        List<Opportunity> oppList = new List<Opportunity>();
        oppList= [ select Organization__c,name, accountid, Account.Name,Account.BillingCountry from opportunity where id =:ApexPages.currentPage().getParameters().get('oppid')];
        if(oppList!=null && oppList.size()>0)
        {
            finalURL=finalURL + +'&Name='+EncodingUtil.urlEncode(oppList[0].name, 'UTF-8');
            if(quoteIds != null && quoteIds.size() > 0 && quoteIds.containsKey('AccountId')){
                accountId += quoteIds.get('AccountId').Field_Id__c;
                finalURL=finalURL + '&' + accountId + '=' + EncodingUtil.urlEncode(oppList[0].Account.Name , 'UTF-8') + '&' + accountId + '_lkid=' + oppList[0].AccountId;                        
            }
        }
        //**TA513 added by Dilip on 15/10/2014
        if(quoteIds != null && quoteIds.size() > 0 && quoteIds.containsKey('Payment_Terms') && oppList!=null && oppList.size()>0)
        {  
            List<Sales_Area_Data__c> paymentTermsList = new List<Sales_Area_Data__c>();
            paymentTermsList = [select Payment_Terms__r.Name,Payment_Terms__c from Sales_Area_Data__c where Account__c =:oppList[0].AccountId and Organization__c =: oppList[0].Organization__c limit 1];
            system.debug('****paymentTermsList***'+paymentTermsList); 
            if(paymentTermsList !=null && paymentTermsList.size()>0 && paymentTermsList[0].Payment_Terms__c!=null)
            {
                finalURL=finalURL+'&' + quoteIds.get('Payment_Terms').Field_Id__c + '='+ paymentTermsList[0].Payment_Terms__r.Name+ '&' +quoteIds.get('Payment_Terms').Field_Id__c+ '_lkid=' +paymentTermsList[0].Payment_Terms__c;
            }
        }
        //**TA604
        Date dt= system.today();
        Map<String,String> countryNumberOfDaysMap = new Map<String,String>();
        List<InterfaceCodeConversion__c> countryNumberOfDays =[select key__c,Value__c from InterfaceCodeConversion__c where Field_Name__c='ExpirationDate' and Object_Name__c='Quote'];
        for(InterfaceCodeConversion__c codeCov:countryNumberOfDays)
        {
            countryNumberOfDaysMap.put(codeCov.key__c,codeCov.Value__c);
        }
        Date newDate;
        if(oppList[0].Account.BillingCountry!=null && countryNumberOfDaysMap.containsKey(oppList[0].Account.BillingCountry))
        {
            newDate=dt.addDays(Integer.valueOf(countryNumberOfDaysMap.get(oppList[0].Account.BillingCountry)));
        }
        else
        {
            newDate=dt.addMonths(1);
        }
        
        //system.debug('****dt***'+dt); 
        
        //system.debug('****dt***'+newDate); 
        //system.debug('****dt.format()***'+newDate.format()); 
        //finalURL=finalURL+'&ExpirationDate='+dt.day()+'/'+dt.month()+'/'+dt.year();
        finalURL=finalURL+'&ExpirationDate='+newDate.format()+'&'+quoteIds.get('Account__c').Field_Id__c+ '=' + EncodingUtil.urlEncode(oppList[0].Account.Name , 'UTF-8') + '&' + quoteIds.get('Account__c').Field_Id__c+ '_lkid=' + oppList[0].AccountId;
        system.debug('****'+finalURL);
        pageRef = new PageReference(finalURL);
        pageRef.getParameters().put('oppid',ApexPages.currentPage().getParameters().get('oppid'));
        system.debug('****pageRef***'+pageRef); 
        return pageRef;
   }
 Getting error: Compile Error: Constructor not defined: [batchupdate].<Constructor>() at line 6 column 20

CODE:
global class Schedulebatchupadte  implements Schedulable 

{
    global void execute(SchedulableContext sc) 
    {
    
    batchupdate bu=new batchupdate();    
   
    Database.executeBatch(bu);
    } 
}
Here Parent object is Account,and child object is Certification__c,and the field to be updated in Parent object is Rating
there is channelpartnercertification recordtype on certification object,
1.    Check the active 'Channel Partner Certification' against an Account. (Active is indicated in Green(static resource is used to appear) on certification object based on start date/end date)
2.    If 'Active Flag' for 'Channel Partner Certification' is available, then the field 'SPP Level Achieved' field on Account will be 'Select Expert'.
3.    Out of active certifications, if 'Start Date' is future Date then the system will check the nearest start date of the certificate to change the               field 'SPP Level Achieved' on Account will be 'Select Expert'. .
4.    Based on future 'Start Date', it will run the update process to change the Status of field 'SPP Level Achieved' on Account Object as 'Select           Expert' on that particular start date.
5.    If no active 'Channel Partner Certification' is found against the Account, it will change field 'SPP Level Achieved' on Account Object as 'No             Level'.
6.    The system will also check the 'Expiry Date' of  'Channel Partner Certification' and accordingly run update process to change the Status of               field 'SPP Level Achieved' on Account Object as 'No Level'  on particular start date.
 Getting error: Compile Error: Constructor not defined: [batchupdate].<Constructor>() at line 6 column 20

CODE:
global class Schedulebatchupadte  implements Schedulable 

{
    global void execute(SchedulableContext sc) 
    {
    
    batchupdate bu=new batchupdate();    
   
    Database.executeBatch(bu);
    } 
}
Here Parent object is Account,and child object is Certification__c,and the field to be updated in Parent object is Rating
The below is uncovered Code,can anyone help me
if(lstUser != null && lstUser.size() > 0){
                    for(User user : lstUser){
                        if(mapOwnerLeadIds.containsKey(user.id) && mapOwnerLeadIds.get(user.id) != null ){
                            for(id ids : mapOwnerLeadIds.get(user.id)){
                                Task objTask=new Task();
                                objTask.WhoId=ids;
                                objTask.Subject='Sales User did not updated the lead since 7 days.';
                                objTask.OwnerId=user.ManagerId;
                                objTask.Priority='Normal';
                                objTask.status='Not Started';
                                lstTask.add(objTask);
                            }

====================================================
@isTest
private class LeadTriggerTest {

    static testMethod void myUnitTest() {
        
        TestDataHelper.profileName='Fujitsu Telemarketing Agency';
        User systemAdministrator = (User)TestDataHelper.createSObject('User');
        system.debug('chcking --> '+ systemAdministrator.Alias);
        systemAdministrator.Alias = 'userabc';
        insert systemAdministrator;
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        list<Account> lstAccount=(list<Account>)TestDataHelper.createSObjectList(Constant.accountObject,false,4);
        system.assertEquals(4, lstAccount.size());
        //lstAccount[0].Sales_Channel__c='Directly Managed';
        //lstAccount[1].Sales_Channel__c='Channel Managed';
        lstAccount[1].Partner__c=true;
        lstAccount[1].eMail_Address__c = 'my@email.com';
        lstAccount[1].Website = 'myWeb.site';
        
        lstAccount[2].Account_Segment__c= 'Accounts';
        lstAccount[3].Account_Segment__c= 'Accounts';
        
        insert lstAccount;
     
        List<Organization__c> lstOrganization = (List<Organization__c>)TestDataHelper.createSObjectList(Constant.organizationObject,false,4); 
        insert lstOrganization;
        system.assertEquals(4, lstOrganization.size() );
        
        List<OrganizationUser__c> lstOrgUser = (List<OrganizationUser__c>)TestDataHelper.createSObjectList(Constant.organizationUserObject,false,4);
        system.assertEquals(4, lstOrgUser.size() );
        for(integer i=0;i<lstOrgUser.size() ;i++){
            lstOrgUser[i].Organization__c=lstOrganization[i].id;
            lstOrgUser[i].User__c=systemAdministrator.id;
        }
        insert lstOrgUser;
        
        list<Lead> lstLead=(list<Lead>)TestDataHelper.createSObjectList('Lead',false,6);
        for(integer i=0;i<lstLead.size()-2;i++)
        {
            lstLead[i].Organization__c=null;
            lstLead[i].Account__c=lstAccount[i].id;
            lstLead[i].Status ='Qualified';
            lstLead[i].Country='India';
            lstLead[i].Company='Fujitsu';
         //   lstLead[i].CompanyDunsNumber='12345';
            
        }
        lstLead[4].Account__c= null;
        lstLead[4].Country= 'India';
        lstLead[5].Account__c= null;      
        lstLead[5].Company= 'Fujitsu';
                    
        
        List<AccountTeamMember> lstAccTeamMember=(List<AccountTeamMember>)TestDataHelper.createSObjectList(Constant.accTeamMemberObject,false,4); 
        for(integer i=0;i<lstAccTeamMember.size() ;i++) {
            lstAccTeamMember[i].UserId=systemAdministrator.id;
            lstAccTeamMember[i].AccountId=lstAccount[i].id;
            lstAccTeamMember[i].TeamMemberRole ='Account Manager';
        }
        lstAccTeamMember[1].TeamMemberRole='Partner Manager (PAM)';  
        insert lstAccTeamMember;
        
        List<Organization_Field_Id__c> lstOrgFieldIds=TestDataHelper.getOrganizationFieldIds();
        insert lstOrgFieldIds;
        System.debug('lstOrgFieldIds::>>'+ lstOrgFieldIds);
        
        Test.startTest();   
            for(integer i = 0 ; i<lstLead.size() ; i++)
            {
                lstLead[i].CompanyDunsNumber = '12345';
            }               
            system.debug('lstLead --> '+lstLead);        
            insert lstLead;
            System.debug('Lead ::>>'+ lstLead);
            System.debug('Lead Insert ::>>'+ [Select Id, ownerid from Lead]);       
           
            for(integer i=0;i<lstLead.size()-3;i++){
                lstLead[i].Organization__c  = lstOrganization[i].id;
               // lstLead[i].CompanyDunsNumber= '123456' ;
                lstLead[i].IsModifiedCheck__c = true;
            }            
            try {               
                update lstLead;         
                System.debug('Lead Update::>>'+ lstLead);   
             }
             catch(Exception e) {               
             }             
        Test.stopTest();        
    }
    
    static testMethod void myUnitTest1() {
        TestDataHelper.profileName='Fujitsu Telemarketing Agency';
        User systemAdministrator = (User)TestDataHelper.createSObject('User');
        
        systemAdministrator.Alias = 'userabc';
        insert systemAdministrator;
        
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        List<Account> lstAccountObject=(List<Account>)TestDataHelper.createSObjectList(Constant.accountObject,false,2);
        //lstAccountObject[0].Sales_Channel__c='Channel Managed';
        lstAccountObject[0].Partner__c=true;
        lstAccountObject[0].eMail_Address__c = 'my@email.com';
        lstAccountObject[0].Website = 'myWeb.site';
        lstAccountObject[1].Account_Segment__c='Aquisition';
        insert lstAccountObject;
        
        
        User us=new User();
        Task objTask=new Task();
        
        objTask.WhoId=us.id;
        objTask.Subject='Sales User ';
        objTask.OwnerId='85858964';
        objTask.Priority='Normal';
        objTask.status='Not Started';
       
        insert objTask;
        
        Organization__c organizationObject = (Organization__c)TestDataHelper.createSObject(Constant.organizationObject); 
        insert organizationObject;
        
        List<OrganizationUser__c> lstOrgUser = (List<OrganizationUser__c>)TestDataHelper.createSObjectList(Constant.organizationUserObject,false,1);
        system.assertEquals(1, lstOrgUser.size() );
        for(integer i=0;i<lstOrgUser.size() ;i++){
            lstOrgUser[i].Organization__c=organizationObject.id;
            lstOrgUser[i].User__c=systemAdministrator.id;
        }
        insert lstOrgUser;
        
        List<Lead> lstLeadObject=(List<Lead>)TestDataHelper.createSObjectList(Constant.leadObject,false,2);
        for(integer i=0;i < lstLeadObject.size(); i++){
            lstLeadObject[i].Status ='Qualified';
            lstLeadObject[i].OwnerId=systemAdministrator.id;
            lstLeadObject[i].Account__c=lstAccountObject[i].id;
            lstLeadObject[i].CompanyDunsNumber = '12345' ;
        }
        
        
        list<AccountTeamMember> lstAccTeamMemberObject=(list<AccountTeamMember>)TestDataHelper.createSObjectList(Constant.accTeamMemberObject,false,2); 
        for(integer i=0;i<lstAccTeamMemberObject.size();i++){
            lstAccTeamMemberObject[i].UserId=systemAdministrator.id;
            lstAccTeamMemberObject[i].AccountId=lstAccountObject[i].id;
            
        }
        lstAccTeamMemberObject[0].TeamMemberRole ='Partner Manager (PAM)';
        lstAccTeamMemberObject[1].TeamMemberRole ='Account Manager';
        
        insert lstAccTeamMemberObject;
        
        Test.startTest();
            insert lstLeadObject;
        Test.stopTest();
        
    }
    
}
Hi,

Anybody suggest me a simple process to copy a record from one custom object to another custom object on button click. 


 
DeleteQuoteLineItemCTLRTest.myUnitTest -- System.DmlException: Insert failed. First exception on row 0; 

first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Quote Account and the Opportunity Account must be insync: [Account__c]

    Stack trace: Class.DeleteQuoteLineItemCTLRTest.myUnitTest: line 58, column 1



==========================================================

@isTest
private class DeleteQuoteLineItemCTLRTest {

    static testMethod void myUnitTest() {
        Organization__c organizationObj = (Organization__c)TestDataHelper.createSObject('Organization__c');
        insert organizationObj;
        TestDataHelper.createSalesRegionUser(organizationObj.id);
        
        Account accObj = (Account) TestDataHelper.createSObject('Account');
        accObj.BillingCountry = 'Germany';
        insert accObj;
        
        AccountContactRole accountContactRole=(AccountContactRole)TestDataHelper.createSObject('AccountContactRole',true,1);
        Opportunity oppty=(Opportunity)TestDataHelper.createSObject('Opportunity');
        oppty.accountId=AccountContactRole.AccountId;
        accountContactRole.IsPrimary=true;
        insert accountContactRole;
        insert oppty;
        
        system.assertequals(oppty.accountid,accountContactRole.AccountId);
        Quote quote = (Quote)TestDataHelper.createSObject('Quote');
        quote.opportunityId=oppty.id;
        quote.Sold_To__c = accobj.Id;
        //quote.Account__c= accObj.Id;
        //quote.Account__c = accObj.Id;
        insert quote;
        
        
        system.assertequals(quote.OpportunityId,oppty.id);
        list<QuoteFieldIds__c> quoteFields=TestDataHelper.getQuoteFieldIds();
        insert quoteFields;
        
        system.Test.setCurrentPage(Page.AppendSaveURLQLI);
        
         Test.startTest();
            // Run as System Administrator
            //system.runAs(systemAdministrator){ 
                //runDeleteQuoteCTLR(quote);
                ApexPages.currentPage().getParameters().put('newid',quote.id);
                ApexPages.currentPage().getParameters().put('oppid',oppty.id);
                runDeleteQuoteCTLR(quote);
                system.assertequals(ApexPages.currentPage().getParameters().get('newid'),quote.id);
                system.assertequals(ApexPages.currentPage().getParameters().get('oppid'),oppty.id);
                //ApexPages.currentPage().getParameters().put('save_new','Https://login.salesforce.com?id=test');
                //runDeleteQuoteCTLR(quote);
            //}
            
        Test.stopTest();
    }
    static void runDeleteQuoteCTLR(Quote quote){
        ApexPages.Standardcontroller controller=new ApexPages.Standardcontroller(quote);
        DeleteQuoteLineItemCTLR deleteQLICTLR=new DeleteQuoteLineItemCTLR(controller);
        deleteQLICTLR.deleteQLI();
        deleteQLICTLR.appendSaveURL();
    }
}
 Getting error: Compile Error: Constructor not defined: [batchupdate].<Constructor>() at line 6 column 20

CODE:
global class Schedulebatchupadte  implements Schedulable 

{
    global void execute(SchedulableContext sc) 
    {
    
    batchupdate bu=new batchupdate();    
   
    Database.executeBatch(bu);
    } 
}