7 votes
Accepted

Collection size 1.079 exceeds maximum size of 1.000

Adding readOnly="true" to the Visualforce page should fix your problem as explained in Setting Read-Only Mode for an Entire Page. Note that this will raise the limit from 1,000 to 10,000 so ...
user avatar
  • 130k
6 votes
Accepted

Is it possible to get a Custom Setting without the cost of a SOQL query and at the same time do it DYNAMICALLY without hardcoding the setting?

There's no way to do this directly; there's no unique common parent type or interface, we can't access namespace properties dynamically, we don't have proper language reflection, etc. Basically, the ...
user avatar
  • 434k
6 votes
Accepted

Platform Events- Event Delivery Limit for Simple Use Case

If I have 1000 users on SF and they receive every event and 51 calls come in == 51 published platform events to 1000 waiting users won't I go past the limit? Yes the number of events delivered would ...
user avatar
5 votes
Accepted

Penalties? - Code ran in seconds yesterday, today it times out

The CPU governor limit includes the time spent by the system writing to the log file, so the more detailed the logs, the more you risk running into a CPU limit exceeded problem. Maximum level logging ...
user avatar
  • 434k
5 votes
Accepted

Hitting governor limits and getting the "Apex CPU time limit exceeded"

There's a lot going on in this code, but I'll start with some of the basics. First, use Test.startTest() before you insert the leads. This gives you more CPU time for you to test with. However, it's ...
user avatar
  • 434k
4 votes

Does Platform event subscription applies to PE Triggers too?

Event Delivery refers to CometD subscribers such as: Lightning Web Components that use lightning-emp-api to receive Platform Events Visualforce pages that use a CometD implementation to subscribe to ...
user avatar
4 votes
Accepted

Does Platform event subscription applies to PE Triggers too?

You should really link to the docs you reference. Here's what I believe to be the relevant passage: Non-CometD clients, including Apex triggers, processes, and flows, don’t count against the event ...
user avatar
  • 143k
3 votes
Accepted

What's the most efficient way to generate XML using apex?

Any Apex code will fail because of governor limits if the volume of data is open ended. Some problems can be solved in Apex if the data can be broken up into determinate sized chunks and worked on in ...
user avatar
  • 130k
3 votes
Accepted

Batch Apex Uncatchable/uncaught exceptions

The following point should be noted from the documentation (my emphasis): Each execution of a batch Apex job is considered a discrete transaction. For example, a batch Apex job that contains 1,000 ...
user avatar
  • 27.3k
3 votes

Getting error System.AsyncException: Future method cannot be called from a future or batch method: when I am calling future method from a trigger

The error message does a pretty good job of describing the issue here. You have a trigger on Lead that calls an asynchronous @future method Your @future method updates your Leads Which causes your ...
user avatar
  • 48.3k
3 votes

Governor Limits related to SOQL in Apex code for Child Query

To aid in letting Salesforce manage resources in their very multi-tenant environment, they made it so that queries return data in chunks (there's some evidence that the chunk size is 200 like it is ...
user avatar
  • 48.3k
3 votes

Help Needed to Bulkify Scheduled Apex Class PLEASE

You have to make the inner loop query into something that's accessible all at once. You can't bulkify that query directly, as you would need to have multiple date offsets. Fortunately, you just need ...
user avatar
  • 434k
3 votes
Accepted

Help Needed to Bulkify Scheduled Apex Class PLEASE

You're struggling because you can't directly bulkify this query List<CampaignMember> camps = new List<CampaignMember>( [ SELECT ID, Campaign_Name__c, Campaign.StartDate, ...
user avatar
  • 86.8k
2 votes
Accepted

Database.executebatch call in for loop causing Codescan warnings

There are few issues in your code. There can only be 5 running Batch Job in an org concurrently and rest 100 goes to flex queue. So in a single transaction you can trigger max 105 Database....
user avatar
2 votes

Unable to escape the governor limits (Too Many SOQL Queries: 201)

These types of computations are considered heavy computations. You will run into governor limits if you try to them synchronously in a single apex transaction. If you have any other ETL tool like ...
user avatar
2 votes

Too many SOQL queries: 101 in salesforce scheduled flow

Short Answer: You can't do this in a Flow. Longer Answer: There's no such mechanism available in Flows like Apex's Map object. So, you're limited to two choices: query inside a loop, or pull out the ...
user avatar
  • 434k
2 votes

Is it possible to get a Custom Setting without the cost of a SOQL query and at the same time do it DYNAMICALLY without hardcoding the setting?

Custom Settings Methods mentions this important difference between querying the Custom Setting directly versus using its provided methods. All custom settings data is exposed in the application cache,...
user avatar
2 votes
Accepted

Re-Parenting in a loop

Depending on how deep you expect your hierarchy to be, you can write two formulas: SuperParent__c (Return Type Text): BLANKVALUE(Parent.Parent.Parent.Parent.ParentId, BLANKVALUE(Parent.Parent.Parent....
user avatar
  • 434k
2 votes
Accepted

Can anyone write this code in optimized way?

You can't optimize the query to support multiple SObjects at once. If you have just a few supported types it's ok to just do SOQL in the loop. If you need to query more than a hundred types at once (...
user avatar
  • 4,117
2 votes
Accepted

Flow - limit exceeded

For a flow, you can execute at most 2000 elements; in practice even a very small loop would be limited to about 500 records. Every box you see in your flow is an element, and every time you hit a new ...
user avatar
  • 434k
2 votes
Accepted

Apex query rows limit reached according to log limit, but not sure about it

ERPvs is a Managed Package, and as you can read more about in the docs here, it gets its own set of governor limits. So, your code is not running into limits, but the managed package code is. You can ...
user avatar
  • 64
1 vote
Accepted

Why CDC has all Sync Limits being an Async process?

CDC events share a 1:1 relationship with transactions, so they need to have the smaller synchronous limits imposed upon them, otherwise they would likely consume too many system resources. Also ...
user avatar
  • 434k
1 vote
Accepted

Considering governor limits when coding a LWC with callouts

a) Show a list of items which would be returned from a Web Service (LWC is rendered, callout is automatically made, JSON array of objects is returned). This sounds like 1 callout per component ...
user avatar
  • 434k
1 vote
Accepted

ConcurrentPerOrgLongTxn Limit exceeded. Does SOQL query and Apex Callout timings gets counted

As the Execution Governors and Limits documentation states: Description Limit Number of synchronous concurrent transactions for long-running transactions that last longer than 5 seconds for each org....
user avatar
  • 434k
1 vote

Database class partial success can exceed governor limits?

If you exceed governor limits, your transaction is immediately and completely rolled back. However, if a partial DML operation has an error, the governor limits will be rolled back for each retry ...
user avatar
  • 434k
1 vote
Accepted

Database class partial success can exceed governor limits?

You cannot catch those exception, so if you hit a governor limit, the whole transaction will rollback. The documentation states All DML operations in a transaction either complete successfully, or if ...
user avatar
  • 3,418
1 vote

what would be the best way to insert bulk data to a custom object

The best way to insert bulk data into a custom object is to use Batch Apex. To use batch Apex, write an Apex class that implements the Salesforce-provided interface Database. Batchable and then invoke ...
user avatar
1 vote
Accepted

How to build large single XML Document over multiple batches

You can't serialize doc or root. Remove them from the class, and initialize theDocAsString in your start(Database.BatchableContext context) method. public Database.QueryLocator start(Database....
user avatar
  • 434k
1 vote

How to process large volumes of records with callouts?

In my mind, this is an ETL job, which you are trying to replicate. You can consider the following approaches: ETL Maybe be difficult to sell, but there are a lot of tools available on market ...
user avatar
1 vote

Getting error System.AsyncException: Future method cannot be called from a future or batch method: when I am calling future method from a trigger

in your future method you are updating lead record which will again call lead trigger logic and future method will be called again resulting in mentioned error. you can optimized your code to ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible