• Dhriti Ghosh
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi,

I am getting error while parsing datetime field in test class.My controller is working fine:
As I have given below code:
public pagereference saveOpportunity(){
String bcontact='';
String serializedDate = ApexPages.currentPage().getParameters().get('bcontact');
        System.debug('*************'+serializedDate);
       
        if(serializedDate!=''){
         dt = DateTime.parse(serializedDate);
         System.debug('*************'+dt);
        }
}
In test class I am writing :
Datetime nowdate=System.now();
        string strfromdate = nowdate.format();
        system.debug('startdate :' + strfromdate );
        datetime startdate = datetime.parse(strfromdate);
        system.debug('startdate :' + startdate);
        oppn.Best_Time_To_Contact__c=startdate ;
I am able to fetch oppn.Best_Time_To_Contact__c properly and also able to insert opportunity record.But when I am calling apex function  dScript.saveOpportunity(),
I am getting this error:

System.NullPointerException: Argument cannot be null.
Can anybody please help me where I am getting issue and how to resolve this issue ASAP.
Hi,

Currently I am facing some issue in VF page for rendering dependent responses in VF page.
The object structure is as follows:
1.Master object
2.Child object.(Master detail records to Master object)
3.Junction object(Master Detail to above both object)

Currently I am fetching records of Master object.Based on Master Object records depending Child object records are displaying.based on the response of this Child object again using junction object I am displaying different Master Object  records.Thing is that this process will continue upto nth level.Can anybody please help me how to solve this problem and display all dependent response in a single VF page.Can anybody please tell me what is the optimized way to solve this problem??


Hi,

I am getting error while parsing datetime field in test class.My controller is working fine:
As I have given below code:
public pagereference saveOpportunity(){
String bcontact='';
String serializedDate = ApexPages.currentPage().getParameters().get('bcontact');
        System.debug('*************'+serializedDate);
       
        if(serializedDate!=''){
         dt = DateTime.parse(serializedDate);
         System.debug('*************'+dt);
        }
}
In test class I am writing :
Datetime nowdate=System.now();
        string strfromdate = nowdate.format();
        system.debug('startdate :' + strfromdate );
        datetime startdate = datetime.parse(strfromdate);
        system.debug('startdate :' + startdate);
        oppn.Best_Time_To_Contact__c=startdate ;
I am able to fetch oppn.Best_Time_To_Contact__c properly and also able to insert opportunity record.But when I am calling apex function  dScript.saveOpportunity(),
I am getting this error:

System.NullPointerException: Argument cannot be null.
Can anybody please help me where I am getting issue and how to resolve this issue ASAP.