+ Start a Discussion
plapla 

SQL query

Hello,

I wrote a simple query below in my Apex trigger but got the error that says "variable does not exist Type". Type is a standard field in the Account object. I do not understand why it throws me this error. Please help. Thanks

 

Account aName = [SELECT id, name, Type FROMAccountWHERE Carrier_ID__c =: CarrierId && Type == 'Client' && RecordTypeId == '01230000000XhdNAAS'limit 1];

 

Paul

 

Rakesh BoddepalliRakesh Boddepalli

Hi ,

 

Modify your query like below and try again .

Also make sure the variable carrierId is present

 

Account aName = [SELECT id, name, Type FROM Account WHERE Carrier_ID__c =: CarrierId and Type == 'Client' and RecordTypeId == '01230000000XhdNAAS' limit 1];

plapla

Thank you so much. It works fine now. Forgot about the and with &&.

 

Paul

 

Rakesh BoddepalliRakesh Boddepalli
Could you please mark it as a solution and give kudos below my name.

Thanks, Rakesh