Skip to main content

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Or you could use List:

List <Opportunity> opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Or you could use List:

List <Opportunity> opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Or you could use List:

List <Opportunity> opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Or you could use List:

List <Opportunity> opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Or you could use List:

List <Opportunity> opps = [select Id, NewNumberField__c from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Perhaps I'm missing something about your situation...

But for this sort of problem I would usually run code like this multiple times from the developer console:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c == null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 

Raise or lower the limit value depending on whether you are hitting any governor limits. The where clause excludes ones that have already been defaulted.

Correct Syntax:

Opportunity[] opps = [select Id from Opportunity where NewNumberField__c = null limit 100]; for (Opportunity opp : opps) { opp.NewNumberField__c = 0; } update opps; 
Source Link
Keith C
  • 138.3k
  • 31
  • 233
  • 476
Loading