Skip to main content
added 2 characters in body
Source Link
Jannis Bott
  • 856
  • 7
  • 14

Apart from not bulkifying your code, it looks like you are not referencing the account in your where clause. Try the below.

List<Contact> lstCon = [SELECT Id, Admin_User__c, Account_Expiration__c FROM Contact WHERE AccountAccountId = :acc.Id AND Admin_User__c = true]; 

Apart from not bulkifying your code, it looks like you are not referencing the account in your where clause. Try the below.

List<Contact> lstCon = [SELECT Id, Admin_User__c, Account_Expiration__c FROM Contact WHERE Account = :acc.Id AND Admin_User__c = true]; 

Apart from not bulkifying your code, it looks like you are not referencing the account in your where clause. Try the below.

List<Contact> lstCon = [SELECT Id, Admin_User__c, Account_Expiration__c FROM Contact WHERE AccountId = :acc.Id AND Admin_User__c = true]; 
Source Link
Jannis Bott
  • 856
  • 7
  • 14

Apart from not bulkifying your code, it looks like you are not referencing the account in your where clause. Try the below.

List<Contact> lstCon = [SELECT Id, Admin_User__c, Account_Expiration__c FROM Contact WHERE Account = :acc.Id AND Admin_User__c = true];