• harshad kokate
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hi Everyone,

I'm trying to write a simple test class.
My code gives the said error.
In my mind, at the line 21, I don't write an update on the CloseDate field but just a condition (boolean).
What is wrong in the following code?
 
@istest

public class batchOppBisTest {
    static testMethod void validateBatch(){
    
    //création d'une nouvelle opportunité qui répond aux critères du workflow
    
    Opportunity opp1 = new Opportunity (Name = 'opptyDeTest', CloseDate = date.TODAY()+45, Engagement_date_finalisation_commande__c = date.TODAY()-1, StageName='Au planning de livraison');
    
    insert opp1;
        
    //vérification que Nbre de jours avant finalisation a été calculé
    System.debug ('$$$ Nbre de jours avant finalisation' + opp1.Nbre_Jours_Avant_Finalisation__c);
    
    //requête sur opportunités
    
    Opportunity [] tabOpp = [SELECT StageName, CreatedDate FROM Opportunity WHERE StageName = 'Au planning de livraison'];
    Opportunity [] oppCreated = new Opportunity []{};
       for (Opportunity o : tabOpp){
            if (o.CreatedDate = date.Today()){
            oppCreated.add(o);
            System.debug(o);
            }//if
       }//for    
          
    }//validateBatch
    
}//class

Thanks for your help!



 
In one Org we have data model  
i.e 
Object = CountryValidity 
Field : 
  • Country = india , IsValid =True
  • Country = USA , IsValid =False
  • Country = AUS , IsValid =True
  • Country = S.Afrika , IsValid =Flase
  • Country = PAK , IsValid =True

In other org we are creating data for the same object what we want is while creating the data for object I will just enter the "country" field value and "IsValid" field's value we need to check from first org and whatevr will be the value we will store it in current org.
Hope explaination is good enough .....
I have configured all files well i.e generated key>generated config.properties>generated process-conf.xml etc 
So when I m trying to hit thiscommand in CMD >Process.bat "D:\Data Loader\bin\process-config.xml" Account 
I ma receiving this error  "java.lang.ClassNotFoundException: com.salesforce.dataloader.process.Processrunner" in CUser-added imageMD window .
I not sure but I think i am missing anthing in java package inside the dataloader folder ?
there was not javac file present in the java package inside the datalaoder folder still the error is same 
Can anyone help me out with this ??

 
I am using multiselect picklist package from Github I also linked two lists for left and right to display selected and unselected lists 
But now what I need to do is I am fetching and list of picklist values of account and on add button of multiselect picklist I want to insert it to a cusotm setting object with its(Picklist) Name and Api Name all code is redy with me The problem i am facing is when i click that picklist value and add it to the right it shows that its adding in to right (selected list) but it doesnt add it to the custom setting can anyone help me out here?
 
<c:MultiselectPicklist leftLabel="Available Fields" leftOptionsNm="{!SobjectsFields}"  rightLabel="Selected Fields" rightOptionsNm="{!selectedFields}" size="5" width="300px"/>
                                            </apex:pageBlock>

///This is visual force page code where data goes to picklist controller and picklist will adjust it to either select and unselect 

///below is controller function which will insert data in to custom setting object
public PageReference UpdateCustomSetting() {
        try {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'calling After Add button Click'+sobjectsFields));
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'calling After Add button Click'+selectedFields));
            return null;
            selectedFields.add(SelectField);
            OneClickUpdatePicklistConfiguration__c tempCustomSetting = new OneClickUpdatePicklistConfiguration__c();
            String csName = SelectObject + ':' + SelectField;
            List<OneClickUpdatePicklistConfiguration__c> OCupdate=new List<OneClickUpdatePicklistConfiguration__c>([select id,PicklistFieldAPI__c, Name, sObject_API_Name__c, Field_API_Name__c, Field_API_Name_without_Namespace__c from OneClickUpdatePicklistConfiguration__c where sObject_API_Name__c =:SelectObject ]);
            mapObjectToFields = new map < String, set < string >> ();
            for(SelectOption sf : selectedFields){
                tempCustomSetting.Name = csName.length() > 38 ? csName.substring(0, 37) : csName;
	            tempCustomSetting.sObject_API_Name__c = SelectObject;
	            tempCustomSetting.Field_API_Name__c = sf.getlabel();
	            tempCustomSetting.PicklistFieldAPIWithoutPrefix__c=sf.getValue();		            
	            tempCustomSetting.Sobject__c = SelectObject;
	            tempCustomSetting.PicklistFieldAPI__c = sf.getlabel();
               	system.debug('>>>>' +tempCustomSetting.PicklistFieldAPI__c);
            }
		if (tempCustomSetting != null) {
			insert tempCustomSetting;
			return null;
		}else{
			update tempCustomSetting;
			return null;
		}
             
        }catch (System.DmlException e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getDMLMessage(0)));
            return null;
        } catch (Exception e) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
            return null;
	    }
    }

 
scenario is as follows


Create a list custom setting named “Country”.  Create four records of this custom setting:
1.      Name  =  India
2.      Name  =  France
3.      Name  =  Italy
4.      Name  =  USA
Create another list custom setting named “City”. Add a field “Country” of data type  text on this custom setting.

Create following records of this custom setting:

1.      Name =  New Delhi,  Country = India
2.      Name = Mumbai,  Country = India
3.      Name = Pune,  Country = India
4.      Name = Kolkata,  Country = India
5.      Name = Ney York, Country = USA
6.      Name = Miami, Country = USA
7.      Name = Washington DC, Country = USA
8.      Name = Paris, Country = France
9.      Name = Lyon, Country = France
10.   Name = Milan, Country = Italy
11.   Name = Rome, Country = Italy

Create a Visual Force page. This page should display two picklists, one for Country and another for City. Initially city picklist should not display any value; instead it should be dependent upon Country picklist. So when user selects a particular country then City picklist should load all the cities corresponding to the selected country.
In one Org we have data model  
i.e 
Object = CountryValidity 
Field : 
  • Country = india , IsValid =True
  • Country = USA , IsValid =False
  • Country = AUS , IsValid =True
  • Country = S.Afrika , IsValid =Flase
  • Country = PAK , IsValid =True

In other org we are creating data for the same object what we want is while creating the data for object I will just enter the "country" field value and "IsValid" field's value we need to check from first org and whatevr will be the value we will store it in current org.
Hope explaination is good enough .....
Hi Everyone,

I'm trying to write a simple test class.
My code gives the said error.
In my mind, at the line 21, I don't write an update on the CloseDate field but just a condition (boolean).
What is wrong in the following code?
 
@istest

public class batchOppBisTest {
    static testMethod void validateBatch(){
    
    //création d'une nouvelle opportunité qui répond aux critères du workflow
    
    Opportunity opp1 = new Opportunity (Name = 'opptyDeTest', CloseDate = date.TODAY()+45, Engagement_date_finalisation_commande__c = date.TODAY()-1, StageName='Au planning de livraison');
    
    insert opp1;
        
    //vérification que Nbre de jours avant finalisation a été calculé
    System.debug ('$$$ Nbre de jours avant finalisation' + opp1.Nbre_Jours_Avant_Finalisation__c);
    
    //requête sur opportunités
    
    Opportunity [] tabOpp = [SELECT StageName, CreatedDate FROM Opportunity WHERE StageName = 'Au planning de livraison'];
    Opportunity [] oppCreated = new Opportunity []{};
       for (Opportunity o : tabOpp){
            if (o.CreatedDate = date.Today()){
            oppCreated.add(o);
            System.debug(o);
            }//if
       }//for    
          
    }//validateBatch
    
}//class

Thanks for your help!



 

Hi folks,

Please help!?

I'm not a developer and never deployed anything from Sandbox to Production and i've just joined a new company and they have an Apex Class (not written by me) that I need to make some very minor changes to (just need to add three lines of code to a Class that is already 688 lines long).

I've succesfully added the three lines of code to the Apex Class in Sandbox and the class now seems to do what it's suppose to do and works without any issues.

The problem I have now is Deploying it and this is where I'd like some help.

Here's what i've done so far:
1. Refreshed Sandbox, Logged into Sandbox, edited the Apex Class, Saved it, tested functionality - all ok
2. In Sandbox Setup, select Apex Test Execution and run the test on the original Test Class which has NOT been edited and it passes Test 1 & 2
3. Create new Outbound Change Set and add the Apex Class that i've made changes to but add no dependancies as no changes have been made to them.
4. Upload the Change Set
5. Log in to production org, locate the change set under Inbound Change Sets, select Deploy and select to run specified tests choosing the same test used when using the 'Apex Test Execution'
6. Deployment fails saying it only covers 63% of the code.

Why is this when running test in Sandox seems to be fine?

I also tried modifying the test class in sandbox and again run the 'Apex Test Execution' function under setup and all is fine, however when I try to upload both the updated test class and the updated Apex class, I'm still getting the same error.

Please help me understand how I can get this Apex Class deployed into production.

As I mentioned I'm not a developer so would appreciate step by step directions if possible of where I might be going wrong.

Many thanks,
Dave

This is my method of test class which is giving full coverage but while deployment to production its giving an error System.LimitException: TR1:Too many SOQL queries: 101
Stack Trace: (TR1)
For following method:


public static testMethod void InvoicePreviewSingle(){
        
        // Starting Test
        Test.startTest();
        invoiceUtilityListData ();
        test.setCurrentPage(Page.BulkInvoicePreview_v1);
        BulkInvoicePreview_v1 invoicePreview = new BulkInvoicePreview_v1();
        
        
        invoicePreview.recordType = Invoicing_Constants.CONSULTING;
        invoicePreview.timesheet1.TR1__Week_Ending__c = System.today();
        invoicePreview.timesheet.TR1__Week_Ending__c = System.today();
        invoicePreview.InvoiceType = 'Single';
        invoicePreview.invoiceDate = System.today().format();
        invoicePreview.showDisabled = true;
        invoicePreview.statusList.add('Approved');
        
        System.assertEquals(4, accList.size());
        System.assertEquals(accList[0].id ,consultingClosingReport.TR1__Account__c);
        System.assertEquals(2, timesheetList.size());
         System.assertEquals(2,timesheetDetailList.size());
        
        invoicePreview.ContinueRecord();
        
        // Setting the Current Page     
       test.setCurrentPage(Page.BulkInvoice_v1);
        
        ApexPages.CurrentPage().getparameters().put('ids', String.valueOf(accList[0].Id));
        ApexPages.CurrentPage().getparameters().put('closingReportIds', String.valueOf(consultingClosingReport.Id));
        ApexPages.CurrentPage().getparameters().put('invoiceDate', String.valueOf(System.today()));
        ApexPages.CurrentPage().getparameters().put('jobType', Invoicing_Constants.CONSULTING);
        ApexPages.CurrentPage().getparameters().put('weekEndDate', String.valueOf(timesheetList[0].TR1__Week_Ending__c));
        ApexPages.currentPage().getParameters().put('value', String.valueOf(0));
        ApexPages.currentPage().getParameters().put('isPreview', 'true');
        ApexPages.currentPage().getParameters().put('InvoiceType', 'Single');
        ApexPages.currentPage().getParameters().put('isPrint', 'true');
        
        BulkInvoiceController_v1 invoiceCtrl = new BulkInvoiceController_v1();
        System.assertEquals(0, invoiceCtrl.invoiceList.size());
        
        invoicePreview.showInvoices();
        
        invoicePreview.nextList();
        invoicePreview.prevList();
        
        invoicePreview.showDisabled = true;
        invoicePreview.ContinueRecord();
        
        invoicePreview.showInvoices();
        
        // Calling Send Email method
        invoicePreview.SaveAndSendEmail();
        
        invoicePreview.getType();
        invoicePreview.getPeriod();
        invoicePreview.getHasRecords();
        invoicePreview.onChangeFilter();
        invoicePreview.getInvoicingType();
        invoicePreview.getTimesheetStatusOptions();
        
        invoicePreview.updateTimesheets(timesheetList, 'Printed', String.valueOf(System.today()));
        invoicePreview.updatePrintStatus();
        
        //Stopping Test
        Test.stopTest();
               
    }