The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

66

Josh Kaplan the Apex Product Manager gave quite a detailed blog post on this new governor entitled Script Limits, Begone!. In it he states this... What does this CPU timeout include? We are only counting things that require application server CPU use. For example, the time spent in the database retrieving records will not count, nor will time spent ...


33

Can a Salesforce instance contain 50+ million records? Almost certainly. I've seen instances with millions of records, although none as large as 50 million. A Salesforce sales person would be able to confirm the max size of a table, if there is one. (50 million records will get their attention and you can expect a quick answer.) Would I recommend Salesforce ...


31

Being able to store 50M rows in a single organization would require 834 Unlimited Edition licenses, 5000 Enterprise Edition licenses, or 40 500MB "blocks" of additional data storage (or some combination thereof), making storing this amount of data very expensive. Assuming that the organization's soft storage limit was of no concern, hypothetically speaking, ...


29

QueryMore is the appropriate means of accomplishing this if you're getting data all at once. For pagination, such as in a website or portal, sort by some value then use filters. I would recommend a field with a high cardinality (e.g. many unique values) because it makes pagination that much easier. I've posted this answer elsewhere, but I'll post it here, ...


26

You will receive an error message when trying to save files of Error: The total size of apex code in this application after removing comments exceeds the maximum character size of 3,000,000 and the files will not submit to the server. You can contact your account executive and may be able to open a discussion to add to this limit if it is deemed ...


19

I raised a case with SalesForce to ask them the same question. After a several weeks I finally got a reply to say: We have consulted our backline team and they have confirmed that time will change as they are subjected to CPU availability. Processors naturally take a variable amount of time to process code, so it's almost never going to be the ...


18

A quick test would suggest that they do... Here is a simple class in my DE and the code usage If I add loads of characters, the usage goes up.. when I removed them, it went back down, now I added loads of white space, and the usage climbed again: And this is chaining lots of spaces together, so I would say that lots of individual spaces in real code ...


16

Salesforce dev here. Labels from managed packages do not count against the 5000 label limit. Thanks for raising this doc gap; we'll get it updated.


16

Per the Governor Limits, you can only send 5000 single emails a day (or less, depending on license). Using the API or Apex, you can send single emails to a maximum of 5,000 external email addresses per day based on Greenwich Mean Time (GMT). Single emails sent using the Salesforce application don't count toward this limit. There’s no limit on ...


13

Short Answer Yes it does count! How did I find out? I can't find any specific information regarding the storage, but given that the limits are in place to control a multi-tenant system, and that you can retrieve archived content (as per the docs) it would be reasonable to expect that it does count. I just performed a simple test in one of my developer ...


13

I'm sure metadata does not count towards the storage limits, only the records stored inside those custom objects that maybe created. I doubt this is actually documented anywhere so the easiest step might be to file a case with support and send the response to the client. Posted a link to the success community to try and speed things along, this might help:


13

Unfortunately your test is flawed. What you're missing here is that using the Developer Console uses API calls to the Tooling API (it's a little crazy that these are counted, I know)! The API call limit includes inbound calls only. Outbound calls (i.e. callouts) are only governed by the per transaction and maximum timeout limits. The Salesforce Developer ...


13

There are no technical restraints regarding the ten object limit. This is actually mentioned in the documentation somewhere. However, if salesforce.com finds out (however that may be), you would be in violation of your contract and at risk for contractual breach. In theory, this means you'd be forced to pay for the more expensive licenses that you would ...


13

Through trial and error, I was able to determine that Salesforce's limit on the URI length is 16,088 characters. +edit 2019-6-26: Re-ran my code here, and came up with a limit of 16057. Looks like this number might vary from release to release, between pods, or perhaps some other criteria I am unaware of. Beyond that, Salesforce begins returning System....


13

You can use a HAVING clause: AggregateResult[] results = [SELECT COUNT(Id) sum, Tool__c Id FROM Gear__c WHERE Tool__c = :tools GROUP BY Tool__c HAVING COUNT(Id) > 1]; This will give you a list of AggregateResult objects where the sum and Tool__c Id are given. You can even use the Map trick to get the count per record easily: Map<Id, AggregateResult&...


12

I've done jqGrid before in Apex with @RemoteActions and it's definitely the way to go. I think with Ajax toolkit and SOAP, you'll have too much XML bloat compared to JSON for large sets of records. As for loading all 78000 records, I would say you should stick to the limits of loading 2000 records at a time and than breaking those into further subsets of ...


12

You can submit multiple Records for approval, sample code below. List<Approval.ProcessSubmitRequest> requests = new List<Approval.ProcessSubmitRequest> (); for (Id oppId: opportunities) { Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setComments('Submitting request for ...


12

It sounds like you've ran into your API Limit for the 24-period. Check this. Go to Setup and then click System Overview You API Usage will be on the top right. If you are at your maximum, I suggest calling Salesforce-Support immediately, and ask to get your API Limits increased temporarily. SF-Support is generally friendly and will usually grant the ...


12

You'll need to clean up your code. The 3,000,000 character limit is the universal limit for any namespace. I've found that the typical code base can be optimized by at least 50%. Try this: Delete all your unit tests (or comment them out). Then, start writing use-based unit tests, covering each page, trigger, etc that you know you need. Then, review the ...


11

I second superfell's question regarding queries. In terms of DML, one of the design patterns that you might consider, for more reasons than just establishing a test environment without hitting limits, is to cache your DML and perform your updates after all of your triggers have finished processing. As your trigger codebase continues to grow - and ...


11

The Limits class as you have started to discover is only for the current request and does not provide any org wide limit information. Salesforce have partially addressed this with emails, but as far as I can see there is nothing for Batch Apex or @future. Though I have included some thoughts below on both. Emails. There is a couple of methods on the ...


11

When dealing with large data sets your best bet is to leverage batch apex. This has the limitation of being asynchronous, but you can process way more data than you're able to normally. It's simpler than getting bogged down with @future based calls (an older technology on the platform) and is the only way to get a larger set of governor limits to work with. ...


11

I would look at using Batch Apex. It can handle the large data sets. I have found that the code is generally cleaner to write than triggers (e.g., different logic for insert/update, etc.) when the data model is very complex. Even if your list size is greater than 200, Salesforce will break up your lists into chunks of 200 for trigger processing. Each ...


11

This statement As a best practice, don't exceed 10,000 child records for a master-detail relationship. Refers to record relationships, thus it is refering to a parent record with the number of related child records not exceeding 10,000. Thus it means 'per Master' record.


11

@RestResource annotated apex classes are just like normal apex class and only difference is they expose the apex class as a HTTP GET,POST,PUT or PATCH web-service and hence all the governor limits applicable to the apex class context apply here . These limits will be 50,000 queries in a context,150 DML,100 SOQL limit of context ,CPU limit ,Heap size limit ...


11

This is still valid, have a look at the System overview area of your org and you will see there is an indicator bar (shown in screenshot) that details the information you are talking about. I can verify this org has 14 custom objects and 2 custom settings (it is a throwaway dev org of mine I use for playing around in). 16/400 is also exactly 4%.


10

There's a lot to consider here: You'll probably want to use JavaScript Remoting as the transport since you may need to be dealing with more than 1000 records at a time If OFFSET can't work, you can use another field as a "marker". It depends on how your data is structured, how often it gets bulk loaded, etc. Some people have used a standard field like ...


10

Custom settings are cached in a special application layer cache which allows a developer to access this data without performing a query, similar to how a CPU's cache allows it to access frequently accessed information without requesting the data from main system memory. All custom settings are cached, and each record in the cache counts towards the 10MB/1MB-...


10

See the documentation. You can list up to 250 IDs per email. If you specify a value for the targetObjectIds field, optionally specify a whatId as well to set the email context to a user, contact, or lead. This ensures that merge fields in the template contain the correct data.


10

Because you wait until the execute() method to query for the records to delete, you are not utilizing the scope parameter (the second parameter of the Database.executeBatch method--'200' in your case) to limit the size of your batches. Because of this, you are attempting to delete too many records of too many types in a single call. If three different ...


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