You need to sign in to do that
Don't have an account?
Jayesh Deo 2
how to collect lookup relation associated record ID from child record?
Hiring_Manager__c =Parent Object
Recruiter__cm = Child Object (Lookup relation)
I am trying to collect hiring manager ID from recruiter object as shown in below query.
Public Static Void AfterUpdate(Map<ID, Hiring_manager__c> MapHrRecords)
{
List <Recruiter__c> LstRecruiters=[select id, name , location__c, Email__c, Phone__c, HiringManagerid__c
from recruiter__c
where HiringManagerid__c IN:MapHrRecords.keySet() ];
}
ERROR encountered:
No such column 'HiringManagerid__c' on entity 'Recruiter__c'. 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.
Recruiter__cm = Child Object (Lookup relation)
I am trying to collect hiring manager ID from recruiter object as shown in below query.
Public Static Void AfterUpdate(Map<ID, Hiring_manager__c> MapHrRecords)
{
List <Recruiter__c> LstRecruiters=[select id, name , location__c, Email__c, Phone__c, HiringManagerid__c
from recruiter__c
where HiringManagerid__c IN:MapHrRecords.keySet() ];
}
ERROR encountered:
No such column 'HiringManagerid__c' on entity 'Recruiter__c'. 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.
Thank you for the response.
I Updated below mentioned query to fetch details from child object which has associated parent ID via lookup relation.
Public Static Void AfterUpdate(Map<ID, Hiring_Manager__c> MapHrRecords)
{
List <Recruiter__c> LstRecruiters=[select id, name , location__c, Email__c, Phone__c, Hiring_Manager__r.id
from recruiter__c
where Hiring_Manager__r.id IN:MapHrRecords.keySet() ];
}
All Answers
Ensure that the API name of the lookup field on the 'Recruiter__c' object that relates it to the 'Hiring_manager__c' parent object is correct. API names are case-sensitive, so they must match exactly as they are defined in your Salesforce org.
Related:
https://salesforce.stackexchange.com/questions/375357/how-to-query-child-records-of-the-lookup-record-in-a-single-query
If this information helps, please mark the answer as best. Thank you
Thank you for the response.
I Updated below mentioned query to fetch details from child object which has associated parent ID via lookup relation.
Public Static Void AfterUpdate(Map<ID, Hiring_Manager__c> MapHrRecords)
{
List <Recruiter__c> LstRecruiters=[select id, name , location__c, Email__c, Phone__c, Hiring_Manager__r.id
from recruiter__c
where Hiring_Manager__r.id IN:MapHrRecords.keySet() ];
}