You need to sign in to do that
Don't have an account?
divey saini
Compile Error on Trigger
Getting the following error for the trigger below:
Error: Compile Error: Invalid bind expression type of Bank__c for Id field of SObject Customer__c at line 3 column 57 (IN)
trigger BankT on Bank__c (after insert, before update) {
List<Customer__c> CustwithOpps =
[SELECT ID,Name,Region__c FROM Customer__c WHERE ID IN :Trigger.New];
for(Bank__c a : CustwithOpps) {
Customer__c [] relatedOpps =a.Customer__c;
}
}
Error: Compile Error: Invalid bind expression type of Bank__c for Id field of SObject Customer__c at line 3 column 57 (IN)
trigger BankT on Bank__c (after insert, before update) {
List<Customer__c> CustwithOpps =
[SELECT ID,Name,Region__c FROM Customer__c WHERE ID IN :Trigger.New];
for(Bank__c a : CustwithOpps) {
Customer__c [] relatedOpps =a.Customer__c;
}
}
Best Answer chosen by divey saini
Krishna Sambaraju
Trigger.New gives a list of Bank__c records that are getting inserted or updated, so it is trying to query the Customer__c object with the IDs of the Bank__c object, so it is throwing error. Here is how you can do it.
Hope this helps.