[SalesForce] Not able to query on standard Asset field ‘ProductCode’ . Please suggest

List<Asset> lst= [select Id, ProductCode, Product_Family1__c, Product_Family__c from Asset WHERE AccountId = '0015000000IBGof' AND (
                            (NOT IB_Status__c Like  '%eval%') OR
                            (NOT IB_Status__c Like  '%Under Right of Return%') OR
                            (NOT IB_Status__c Like  '%Sold - Demo%') OR
                            (NOT IB_Status__c Like  '%WRITTEN OFF%')
                        ) 
                         AND Product_Family__c != 'Whitewater'];

I am getting below error
No such column 'ProductCode' on entity 'Asset'. 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.

Also I need to use group by (Product_Family1__c, Product_Family__c) this query But getting error

Best Answer

Do you have Visibily on that Field? Default standard Product Code in asset object is not visible, otherwise you can access to the ProductCode by Product2.ProductCode.

Related Topic