+ Start a Discussion

Record Type Id

I am trying to fetch the RecordType ID using the following code but its giving me error

in the code below Asset is my object name

 asset.RecordTypeId==AssetRecTypes__c.getInstance('Personal Assets').RecordTypeId__c 
                                          ||asset.RecordTypeId==AssetRecTypes__c.getInstance('Business Assets').RecordTypeId__c 
                                          ||asset.RecordTypeId==AssetRecTypes__c.getInstance('Real Estate Assets').RecordTypeId__c)


You need to post the error message to give us a chance to suggest solutions.  Snippets of code with no context don't give us anything to go on.


the error that i am getting is 

System.NullPointerException: Attempt to de-reference a null object 


This sounds like one of your getinstance method calls is returning null.


Do you definitely have custom setting instances with those names?