2

Im getting the following error:

The configuration of your org has changed, please reload the page. Missing dependent object: Field: Opportunity.ContactId

This happens in the for loop declaration below:

private static void checkContactOpps(Contact contact)
{
    for (Opportunity opp : contact.Opportunities)
    {

    }
}

And this is how I query for the Contacts and the related Opps

//Retrieve the Accounts associated with the Contacts
    List<Contact> contactAcctIds = new List<Contact>(
        [SELECT AccountId,
                (SELECT Id,
                        Name,
                        RecordTypeId,
                        Product_Interest__c,
                        Type,
                        CloseDate,
                        StageName,
                        Season__c,
                        Ticket_Type__c,
                        LeadSource,
                        AccountId
                 FROM Opportunities)
         FROM Contact
         WHERE Id IN :contactIds
        ]
    );

I tried searching online, but I couldn't find any relevant solution to the problem. I'm a System Admin too, so I don't think its a permissions issue.

  • 2
    FYI How to get Opportunities from Contacts that includes an unaccepted answer that says "This field is a bug and should not be used. It is technical debt that SFDC has not cleaned up yet." and has various other comments. – Keith C Jan 6 '17 at 23:03
2

@keithc should write the accepted answer, but to further elaborate when faced with issues like this:

If you look in Workbench, there is no child relationship from Contact to Opportunities: enter image description here

nor a lookup relationship from Opportunity to Contact:

enter image description here

So, if the object, field, or relationship is not visible to the metadata browser, it won't be available to your application.

  • Thanks for the insight! That makes perfect sense since the Contact Role is the junction object between the two. – user2278489 Jan 12 '17 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.