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
Sibasish PanigrahiSibasish Panigrahi 

Error: Compile Error: Invalid type: Check__c

I have created a lookup field in Account and while creating a trigger i used this "Check__c" to create new instance of that particular lookup.
eg: Check__c obj = new Check__c();
But this error keeps poping up.

(Note: Due to restriction i'm unable to share the code or actual field and object name. And i had checked TONS on times that i had used double underscore while using the custom object)
Best Answer chosen by Sibasish Panigrahi
HARSHIL U PARIKHHARSHIL U PARIKH
Wait.. you said Check__c is a custom look-up field correct? What is the name of the obejct?
It should be something like below,

Object_Name__c obj = New Object_Name__c();

All Answers

Dushyant SonwarDushyant Sonwar
CHeck does this have namespace prefix if it has then you might have to change
Check__c obj = new Check__c();
to
[NamespacePrefix]__Check__c obj = new [NamespacePrefix]__Check__c();
HARSHIL U PARIKHHARSHIL U PARIKH
Wait.. you said Check__c is a custom look-up field correct? What is the name of the obejct?
It should be something like below,

Object_Name__c obj = New Object_Name__c();
This was selected as the best answer
Sibasish PanigrahiSibasish Panigrahi
thank you harsh, it was silly me who forgot to check the object name :-)