You need to sign in to do that
Don't have an account?
aottaru
SOQL in Apex Trigger
Does anyone know why I am getting the error "Didn't understand relationship 'dispatch__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."
Here is the line of the code with the error.
List<Charter__c> Dispatch = [select id,(Select Id from dispatch__c WHERE Date_Scheduled__c != null)
from Charter__c where ID IN: Trigger.NewMap.KeySet() ORDER BY Date_Scheduled__c];
Thanks.
Here is the line of the code with the error.
List<Charter__c> Dispatch = [select id,(Select Id from dispatch__c WHERE Date_Scheduled__c != null)
from Charter__c where ID IN: Trigger.NewMap.KeySet() ORDER BY Date_Scheduled__c];
Thanks.
All Answers
Try the below.
List<Charter__c> Dispatch = [select id,(Select Id from dispatch__r WHERE Date_Scheduled__c != null)
from Charter__c where ID IN: Trigger.NewMap.KeySet() ORDER BY Date_Scheduled__c];
Note: sometimes the relationship field in your child object may not have the same name as the object itself. Let me know if the above doesnt work then I'll show you how to check.