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
Frances AllenFrances Allen 

LastViewedDate Column Entity Error Winter '19

Here's my error: 

No such column 'lastvieweddate' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name.
  • I am not aware of this field on Contact in sandbox or production 
  • It is only present in metadata 
  • It is not used in Non-profit success pack field sets 
Very little is known about this error outside of these above points. It's not feasible to change my API to 27 or below as suggested by some. 
Does anyone know what is triggering this error? This is where the actual error is being triggered. In the bolded code below.
 
@isTest
private class ContactSearchController_Test {
	
    static testMethod void testClass() {
        Topic__c t = new Topic__c(Name='Test Topic', Active__c=true, Abbreviation__c='tt');
        insert t;
        City__c ci = new City__c(Name='Test City');
        insert ci;
        
        Account a = TestDataFactory.getCollege();
        a.City__c = ci.Id;
        insert a;

        Contact c = new Contact(lastName='lName', firstName='fName', Position__c='Test Postition', AccountId=a.Id, Topic_1__c=t.Id, MobilePhone='(703) 555-5555', Email='Test@acfsolutions.com');
        Contact c2 = new Contact(lastName='lName2', firstName='fName2', Position__c='Test Postition', AccountId=a.Id, Topic_1__c=t.Id, MobilePhone='(703) 556-5556', Email='Test2@acfsolutions.com');
        insert new List<Contact>{c, c2};

        User u = TestDataFactory.getUser(TestDataFactory.getLeadershipCouncilProfile(), c);

        System.runAs(u) {
            ContactSearchController.getSearchDetails();
            
            ContactSearchController.getContactDetail(c.Id);
        }
    }
}


 
Khan AnasKhan Anas (Salesforce Developers) 
Hi Frances,

Greetings to you!

This is a known issue: https://success.salesforce.com/issues_view?id=a1p30000000T0tvAAC

Please refer to the below links which might help you further.

https://salesforce.stackexchange.com/questions/13120/no-such-column-lastvieweddate-on-entity-quote-c

https://github.com/SalesforceFoundation/Volunteers-for-Salesforce/issues/197

https://salesforce.stackexchange.com/questions/224165/invalid-field-lastvieweddate-when-saving-recordeditform

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas