You need to sign in to do that
Don't have an account?

Accesing MAP Value
Hi,
I am new to salesforce. while trying to access my map value, i am getting the exception like
System.NullPointerException: Attempt to de-reference a null object
My declaration is like
map<ID,Customobj> mymap =new map<ID,Customobj> ();
ID is a custom object ID ( which is a lookup field in Customobj)
after putting the value, i can see the map size is 1
Customobj obj = new Customobj();
i am trying to access the map value by providing the ID
obj =mymap.get(ID); ==>verified ID is valid one
now trying to access the field of this object
obj.fieldname ====> getting Null pointer exception
Please advice
I am new to salesforce. while trying to access my map value, i am getting the exception like
System.NullPointerException: Attempt to de-reference a null object
My declaration is like
map<ID,Customobj> mymap =new map<ID,Customobj> ();
ID is a custom object ID ( which is a lookup field in Customobj)
after putting the value, i can see the map size is 1
Customobj obj = new Customobj();
i am trying to access the map value by providing the ID
obj =mymap.get(ID); ==>verified ID is valid one
now trying to access the field of this object
obj.fieldname ====> getting Null pointer exception
Please advice
There is simple step to avodi this type of error
Please mark it as a solution if it help you.