0
votes

I have created lookup-relationship for standard object Account and custom object Child__c in salesforce. Using following query when I tries to fetch Account's i.e parent object field, query assist returns.

Queries are:

1. Select id, Account__r.Active__c from Child__c 
2. Select id, Account__r.Type from Child__c 

enter image description here

Can anybody assist me to solve this?

1

1 Answers

0
votes

It means that those record are linked to no Account. You could verify adding a WHERE clause to the query: SELECT Id, Account__r.Active__c from Child__c WHERE Account__c != null. This query should return 0 record.
You have to update those records setting the lookup field Account__c with a valid id.
Once Account__c holds a reference to an Account, if you rerun that query and you'll see the parent fields.

By the way, when you create a new custom field, even if you add a default value (you can't for a lookup field), it will be null for the pre-existing records.