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
Shalu JainShalu Jain 

Governor limits

Hey,,
Can anyone tell me how can I reset the governor limits??
Best Answer chosen by Shalu Jain
pbattissonpbattisson
Only in a unit test context or by calling an asynchronous method. 

In a unit test you can execute code within Test.startTest() and Test.stopTest() to give the code within that block its own set or parameters (only available in unit tests).

If you call an asynchrnous method (@future, batch, scheduled) the code within that asynronous method when run will have its own set of governor limits.

Otherwise you cannot and need to refactor/improve your code to consume less resources.

All Answers

pbattissonpbattisson
Governor limits are (broadly speaking) provided on a per transaction basis. In order to get a new set of governor limits you need to start a new transaction with Salesforce. 

Are you hitting the governor limits with a particular process?
Shalu JainShalu Jain
Can I reset them after a transaction particular transaction,, without starting a new one???
pbattissonpbattisson
Only in a unit test context or by calling an asynchronous method. 

In a unit test you can execute code within Test.startTest() and Test.stopTest() to give the code within that block its own set or parameters (only available in unit tests).

If you call an asynchrnous method (@future, batch, scheduled) the code within that asynronous method when run will have its own set of governor limits.

Otherwise you cannot and need to refactor/improve your code to consume less resources.
This was selected as the best answer
Shalu JainShalu Jain
okay thanx..