I have two objects:
Inquiry
Patient
Patient has many inquiries so there is a lookup field on the inquiry object.
now here is my code:
Patient__c p = [Select Id from Patient__c where id='00QJ000000B4yXa'];
SObject container;
Schema.sObjectType sType = Schema.getGlobalDescribe().get('inquiry__c');
container = sType.newSObject();
I need a way to get the name of the lookup field on the child object .
in this example I would need the patient__c fieldname on the child record