Header Ads Widget

'Sales__r' is not a valid child relationship name for entity Object(Sales__c) || interview stuff


'Sales__r' is not a valid child relationship name for entity Object(Sales__c)



Technical Issue:

      We are facing an error on Custom page time of loading and error is “'Sale_Comments__r' is not a valid child relationship name for entity Sale. This error comes only for Standard Sales User profiles.



Description:

       We have analyzed the issue and error comes from related list of child object. We are populating the related list in this page.

Code line of related list is : <apex:relatedList list="Sales_Comments__r">.



Analysis:

 Given below points for analysis of Parent Child relation ship:

  1. Parent object is Sales__c and child object is Comment__c.
  2. on Comment__c object Request_Id__c field is Master-Detail and visible to all profiles and API name of child relation ship is Sales_Comments__r.
  3. Checks Standard Sales User profile FLS (Field Level Security) of both object. Where Parent object giving R/C/E access and Child object giving R/C access.
  4. Checks active users of above profiles Territory, User Group etc.
  5. Login with user and run the visual force page but it shows above error.



Visual force Code:

<apex:page standardController="Salest__c">

  <apex:relatedList list="Sales_Comments__r"  />

</apex:page>



Solution:

Login with Profiles active user and follow below steps:

  1. Run the URL like https://intanceof.com/a1eQ0000000b0EcIAI?nooverride=1
  2. Above URL contains instance of sales force and Id of record. Where no override is used to display the override related list.
  3. Kindly check there is Comment related list available or not.
  4. If not available than Click on Customized Page and add related list.
  5. Run the /apex/output?id=record_Id and now you will get output page.



Conclusion:

Use the no override word in URL and checks there is related list available or not.

Post a Comment

0 Comments