You need to sign in to do that
Don't have an account?
System.NullPointerException: Attempt to de-reference a null object
System.NullPointerException: Attempt to de-reference a null object
Class.AAA.: line 44, column 3 External entry point
I got a error message when I open the page on the Salesforce.
I create a class as below.
The message is somehow indicating 3rd line "hasseijikoku.kisyou_id__r.ReportDateTime__c = mstDatetime;"
public with sharing class AAA {
--------- abbreviation----------------
//Constructor
public AAA() {
mstDatetime = Datetime.now();
hasseijikoku = new WXS_T_PopUpReceipt__c();
hasseijikoku.kisyou_id__r.ReportDateTime__c = mstDatetime;
}
--------- abbreviation----------------
There was no error neither class nor visal force on Eclipse side.
I appreciate if anyone could help me find the problem
Regards
Mori
This sounds like the relationship "kisyou_id__r" is evaluating to null. We could really do with seeing the rest of the code. For example, how to you construct your "hasseijikoku" instance?
Thank you Bob Buzzard
I deleted 3rd line "hasseijikoku.kisyou_id__r.ReportDateTime__c = mstDatetime;"
It works OK.
I just copied those 3 lines from other sources.
I didn't understand why I needed to use them.
Thank you for your help
May I ask you one more question?
I would like to write SOQL to retrieve records that includes only matched ReportDateTime__c with mstDatetime ( which is = Datetime.now();)
Only records that matched on Date.
Time is not needed.
Mori
I think you'd want to do that by matching on a range of date/time, from midnight to midnight.
Something like:
Dear bob_buzzard
Thank you for your answer to my second question.
I'll try this one.
Regards
Mori