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
Raquel RiemerRaquel Riemer 

No such column 'cv__Event_Attendee_Account__c' on entity 'cv__Event_Attendee__c'.

I am just trying to replace a field in a controller extension

There is quite a bit of code which is attached to a custom button that generates a report. 

No matter how i put the field in __c __r I am getting an error



 
Matt Brown 71Matt Brown 71
Hey Raquel,

Is cv__Event_Attendee_Account__c a relationship field? Also, have you made sure to check the field permissions to verify the profile being used to run the Apex has access?

Also, posting some more of the code may be helpful here.
Raquel RiemerRaquel Riemer
Account__c is a field on cv__Event_Attendee and it is a lookup field. I am actually looking for the Account__c.name
Matt Brown 71Matt Brown 71
Can I see your select statement?  It sounds like you might have it mixed up a bit.  The error you posted implies you are SELECTING something like 
SELECT cv__Event_Attendee_Account__c FROM cv__Event_Attendee__c

But your reply confuses me thinking you are actually trying to get the Account__c.name field.  

Raquel RiemerRaquel Riemer


    public List<AttendeeWrapper> getAttendees(){
        if(!notSort){
            refresh();
        }
        allAttendees = new List<AttendeeWrapper>();
        List<cv__Event_Attendee__c> localRecords = (List<cv__Event_Attendee__c>)attendee.getRecords();
        Map<Id, cv__Event_Attendee__c> updatedAttendees = new Map<Id, cv__Event_Attendee__c>();
        //String queryStringMap = 'Select Id,Rated_on_Amount__c, Comment_text_area__c, Event_Attendee_First_Name__c,Event_Attendee_Last_Name__c,cv__Contact__r.Outstanding_Balance__c,cv__Event_Attendee_Account__c,Ticket_Amount__c,Payment_Status__c,Additional_Gift__c, cv__Event__c,cv__Event__r.Suggested_Minimum_Donation__c,Registered__c,Account__r.owner.name,Suggested_Rating__c,Pledge_Card_Ask__c,Rating_Reviewed__c,cv__Contact__c,cv__Contact__r.JNF_Giving_Summary_Last_Year_Amount__c,cv__Contact__r.JNF_Giving_Summary_Current_Year_Amount__c,cv__Contact__r.VIS_Number_Formula_Field__c,cv__Contact__r.Name,RSVP__c,Last_Time_Printed__c FROM cv__Event_Attendee__c WHERE Id IN :localRecords'; //Commented by Megha | C-00199693
        String queryStringMap = 'Select Id,Rated_on_Amount__c, Comment_text_area__c, Event_Attendee_First_Name__c,Event_Attendee_Last_Name__c,cv__Contact__r.Outstanding_Balance__c,cv__Event_Attendee_Account__c,Ticket_Amount__c,Payment_Status__c,Additional_Gift__c, cv__Event__c,cv__Event__r.Suggested_Minimum_Donation__c,Registered__c,Account__r.owner.name,Suggested_Rating__c,Pledge_Card_Ask__c,Rating_Reviewed__c,cv__Contact__c,cv__Contact__r.JNF_Giving_Summary_Last_Year_Amount__c,cv__Contact__r.JNF_Giving_Summary_Current_Year_Amount__c,cv__Contact__r.Hidden_VIS__c,cv__Contact__r.Owner.Name,cv__Contact__r.OwnerId,cv__Contact__r.VIS_Number_Formula_Field__c,cv__Contact__r.Name,RSVP__c,Last_Time_Printed__c, Declined__c  FROM cv__Event_Attendee__c WHERE Id IN :localRecords'; //Added by Megha | C-00199693

        queryStringMap += ' ORDER BY ' + (sortField==''?'Rating_Reviewed__c ASC, Pledge_Card_Ask__c DESC':sortField + ' ' + sortDir) + ' NULLS LAST';
        for(cv__Event_Attendee__c att: Database.query(queryStringMap)) {
            updatedAttendees.put(att.Id, att);

        if(previousSortField != null && previousSortField != sortField){
            sortDir = 'asc';
        }
        //,Event_Attendee_First_Name__c,Event_Attendee_Last_Name__c,Event_Attendee_r.Account__c.Name,Ticket_Amount__c,Payment_Status__c,Additional_Gift__c, cv__Event__c,cv__Event__r.Suggested_Minimum_Donation__c,Registered__c,Suggested_Rating__c,Pledge_Card_Ask__c,Rating_Reviewed__c,cv__Contact__c,cv__Contact__r.JNF_Giving_Summary_Last_Year_Amount__c,cv__Contact__r.JNF_Giving_Summary_Current_Year_Amount__c,cv__Contact__r.VIS_Number_Formula_Field__c,cv__Contact__r.Name,RSVP__c
        queryString= 'SELECT Id, Comment_text_area__c FROM cv__Event_Attendee__c WHERE cv__Event__c = \'' +event.Id+'\'  ';

 
Matt Brown 71Matt Brown 71
My advice is that the error is saying that cv__Event_Attendee_Account__c doesn't exist on cv__Event_Attendee__c.  So the first thing I'd do is verify it does, and make sure the field level permissions are set appropriately.

As for the Event_Attendee_r relationship, there is a tool we use where I work called https://workbench.developerforce.com/ which will allow you to auth into your instance and lookup objects and see relationship names.  Id look at cv__Event_Attendee__c object and click the "relationships" drop down and see exactly what the cv__Event_Attendee_Account__c relationship is it's named.

Also - it's a good idea to test your queries using the developer console (if you're not already).
Raquel RiemerRaquel Riemer
I am in the sandbox. 

Sorry if I sound dense.

I do not see this field in workbench however the field does exist

the object is 
cv__Event_Attendee__c
and the field is Account__c (which is a lookup field)
so actually I am looking for the Name field on the Account