You need to sign in to do that
Don't have an account?
Patrick Mayer 4
Standard Controller addFields works fine in sandbox, fails in production
public with sharing class OrdersPageControllerExtension { public ApexPages.StandardController sc; public final Order__c order; public OrdersPageControllerExtension(ApexPages.StandardController stdController) { this.sc = stdController; if (!Test.isRunningTest()) { stdController.addFields(new List<String>{'Products__c', 'Restaurant_ID__c', 'Gift_Card__c'}); } if (order.Products__c != null) { ..... } } }
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Order__c.Products__c
Has anyone else seen this? Is it a bug?
All Answers
Does field exist also in prod env?
Davide
I didn't understand why in Sandbox is working, for what I read: execute 'system.debug' of 'order' obj can help understand if it is instantiated or not.
You can also make a query to retrieve the order...