+ Start a Discussion
Support 3743Support 3743 

Lookup relationship returning null

Hi, I created a custom lookup relationship so that I can access Opportunity when I'm querying Contact:
User-added image

What I want is something like this:

SELECT Email, Look_Opportunity__r.Stage FROM Contact WHERE Oppportunity.Stage != "Not Ready" AND Email != null

However, when I call this the query it returns null for Look_Opportunity: 
User-added image
What's wrong with my code? Many thanks for the help!
Raj VakatiRaj Vakati
Your SOQL is correct .. But you dnt have data that why its returning null . go and update some data that meet the conditions 
Oppportunity.Stage != "Not Ready" AND Email != null and run SOQL again 
Support 3743Support 3743
But when I type SELECT Look_Opportunity__r.Name FROM Contact it still returns null. I'm pretty sure there's data in the Opportunity.Name field. @Raj V