+ Start a Discussion
alchemyalchemy 

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)

bob_buzzardbob_buzzard

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.

alchemyalchemy

the error that i am getting is 

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

bob_buzzardbob_buzzard

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

 

Do you definitely have custom setting instances with those names?