What I am trying to do is to set a date in my date field and also update the object. I am using the class below to do so which works just fine in my sanbox but in production I am getting this error:
System.LimitException: Too many query rows: 50001
public with sharing class updateObject{
public List<NRProducts__c> values;
public PageReference updateObject() {
values=[SELECT Refreshed_Date__c FROM NRProducts__c ];
for (NRProducts__c s :values){
s.Refreshed_Date__c =Date.today();
}
update values;
return null;
}
}
VF Page:
<apex:page showheader="false" controller="updateObject" sidebar="false">
<apex:form>
<apex:commandButton action="{!updateObject}" value="Update"/>
</apex:form>
</apex:page>