function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FuguSailorFuguSailor 

Problem resolving reference values

When my apex code processes the following query:

 

SELECT Name, Requirement_Name__c, Sprint__r.Sprint_Name__c, Stake_Holder__r.Name, Priority__c, Status__c FROM Requirements__c  WHERE  Status__c NOT IN ('Cancelled','Released') ORDER BY Name

 

I do not receive values for the Stake_Holder__r.Name nor the Sprint__r.Sprint_Name__c reference fields. The Stake_Holder__c field holds the Id for a Contact object and the Sprint__c field holds a reference to a Sprint__c custom object. The proper values are shown in the configuration pages for the Requeirements__c records but when the query runs in my controller, there aren't any values shown. This happens both in the developer console and when viewing as a site. If I try to run the query in the developer console, it seems to hang the page. Using the Apex IDE, it executes but I only get the type name of the root referenced object.

 

Any ideas?

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
FuguSailorFuguSailor

Field level security had been set to allow read only for the site.

 

I changed the fields so that for the sprint, it was accessing Sprint__r.Name and for some reason, the Stake_Holder__c field would return the name instead of the ID so I left it at that. Stake_Holder__c is the Id of a Contact but would return the Name of that object. Since it works, I'm not going to complain.

All Answers

sandeep@Salesforcesandeep@Salesforce

The problem is with field level security of two fields for your profile. Sprint Name and Name fieds of Sprint and Stack holder object.  and also check going on native page of these two object Stack holder and Sprint objects.

FuguSailorFuguSailor

Field level security had been set to allow read only for the site.

 

I changed the fields so that for the sprint, it was accessing Sprint__r.Name and for some reason, the Stake_Holder__c field would return the name instead of the ID so I left it at that. Stake_Holder__c is the Id of a Contact but would return the Name of that object. Since it works, I'm not going to complain.

This was selected as the best answer