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
Vikas KVikas K 

cannot fetch the column even having the field accessibility

Hi All ,
 i am stuck up at this point of code
 i cannot fetch the data of the column with a particular record type 

list<product2> p = [select id,name,Gegenkonto__c from product2 where RecordType='Produkte Vertrieb'];

error:
Gegenkonto__c from product2 where RecordType='Produkte Vertrieb' ^ ERROR at Row:1:Column:50 No such column 'RecordType' on entity 'Product2'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

thanks in advance
Best Answer chosen by Vikas K
Maharajan CMaharajan C
Hi,

The problem is in where Query. RecordType  ==> RecordType.Name

list<product2> p = [select id,name,Gegenkonto__c from product2 where RecordType.Name='Produkte Vertrieb'];

Thanks,
Maharajan.C


 

All Answers

Maharajan CMaharajan C
Hi,

The problem is in where Query. RecordType  ==> RecordType.Name

list<product2> p = [select id,name,Gegenkonto__c from product2 where RecordType.Name='Produkte Vertrieb'];

Thanks,
Maharajan.C


 
This was selected as the best answer
Vikas KVikas K
thank you Maharajan and your solution helped me