function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sangeeta.marathe@Futurewise.cosangeeta.marathe@Futurewise.co 

error

i executed my DML query class it is giving me error for the following code

       Account acc= new Account(LastName='ABC',RecordTypeId=RecTypes__c.getInstance('AccountClient').Record_Type_Value__c);

the error that i am geting is as follows

 

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

Class.DatabaseDMLTest.myUnitTest7: line 94, column 91 External entry point

 

 

 

can i get y am i getting this error in test class for DML query

Rahul S.ax961Rahul S.ax961

Thats due to,

there's is no value in RecTypes__c.getInstance('AccountClient').Record_Type_Value__c.

Instead use a query like:

Account acc= new Account(Name='ABC',RecordTypeId=[Select Id from RecordType where name = 'AccountClient'].Id);

sangeeta.marathe@Futurewise.cosangeeta.marathe@Futurewise.co

i just tried to display the ID using the query that you posted but its not giving me any output.