I have a SOQL
to retrieve values for a custom object which has reference to another custom object(Ticket__c)
. I am gettign the following error-
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Payment__c.Ticket__r for the line -
String uname=getPayments.get(i).Ticket__r.User__c;
List<Payment__c> getPayments = [Select Transaction_Number__c,
TransactionDate__c,
Type__c,
Mode__c,
Amount__c,
Ticket__c
from Payment__c];
for(Integer i=0;i<getPayments.size();i++)
{
String uname=getPayments.get(i).Ticket__r.User__c;
}