Skip to main content

I am getting this error: System.IndexOutOfRangeException: Cannot find column Contact__r.Contact_Country__c.

 

How can we resolve this?

1 Antwort
  1. 25. Okt. 2024, 05:41

    Hey @Rajeshwari Jain, the error typically occurs because the referenced field  Contact__r.Contact_Country__c  is either not present in the query result or is incorrectly referenced.

     

    To fix this:

    1. Make Sure to Include the Field in the Query: Verify that Contact__r.Contact_Country__c is selected in your SOQL query:
      1. SELECT Id, Contact__r.Contact_Country__c FROM ParentObject__c WHERE ...
    2. Check for Null Values: Sometimes, Contact__r might be null if there’s no related Contact. Use a null check before accessing it.
    3. Ensure that Contact_Country__c is accessible to the user by checking field-level security or permissions.

    Thanks!

0/9000