5 个回答
Hi Mark,I would expect this to always return null, regardless of context.Generally, unless you have explicitly queried for fields on a related record, a reference using the relationship name will return null or throw a 'field not queried' exception.In your case, if you want to refer to the field Booking1.Selling_Company__r.name, you would need to insert the Booking1 record, then query for that same record:
Please let me know if this helps.Thanks,Apoorvinsert Booking1;
Booking1 = [Select id,name,Selling_Company__r.name from Booking__c where id=:Booking1.id];
System.debug(Booking1.Selling_Company__r.name); // It should give you the desired output