0

My question is if i want to insert 20,000 records and i choose to use UPSERT because it contain both insert and update. my data is going to be updated every day. is it true that UPSERT can only create or modify 25 records at a time..? Does UPSERT have any limitation in creating or modifying any record (like 25 records)..?

Thank you for your solutions and suggestions.

  • where are you getting the 25 number as a limit? Are we talking via REST API or via APEX DML? – cropredy Dec 6 '17 at 1:45
  • ya REST API. when we use UPSERT method – mukky Dec 7 '17 at 0:09
  • REST API composite update will be limited to 25, APEX DML will be 10000 – cropredy Dec 7 '17 at 1:16
  • Is there any link in between REST API and APEX DML..? @cropredy..According to you what is the best solution for this isssue..?. Initial record load will be of thousands of records and there will be a daily update to the records but the record update will be less . (only limit amount of records will be updated) – mukky Dec 8 '17 at 1:00
2

The limit will be 10000. This is same for all DML statement in single transaction.

As Per Salesforce docs enter image description here

enter image description here

So you can see that upsert is also counted as DML statement and for DML statement we have limit of 10K records.

You can also take help of LIMIT Class getDMLStatements(), getLimitDMLStatements() to find the limit in runtime.

| improve this answer | |
  • Thank you for your solution. I am going to use REST API to send data to salesforce. we are building FUSION risk management app on the top of salesforce. will this soultion works...? – mukky Dec 6 '17 at 20:17
  • I am sending you one link please have a look. developer.salesforce.com/docs/atlas.en-us.api_rest.meta/… . is it related to UPSERT..? – mukky Dec 6 '17 at 20:21
  • @mukky its related to REST and SubSequent calls. – Tushar Sharma Dec 7 '17 at 4:50
  • YES, I want solution for REST. Can you please help me in this..? – mukky Dec 8 '17 at 0:48
  • I am going to use REST API @tushar – mukky Dec 8 '17 at 1:06
0

Based on the comment thread, it looks like you have constrained yourself to avoid the "bulk"-type data import features in the SFDC Platform. That is, you've ruled out the Bulk API, Data Loader, and presumably, the SOAP API.

This leaves with a couple of options:

Custom Apex REST class (see Trailhead/Apex doc)

  • This can take in a POST body of whatever you define (an array of objects to insert). Not too big or heap may blow up or CPU limit may blow up. Ideally 200 objects per POST.
  • Then, using Apex DML, you can upsert these and your governor limit will be 10,000 records (across all objects in the transaction)
  • Your client system can call this REST endpoint a handful of times until you've done the initial load and then as needed as new records need to be transferred
  • You will have to write this code and test it per normal SFDC practice

OOTB Composite REST API.

  • Covered in the REST doc here
  • Limited to 25 records per REST call
  • Your client code creates batches of 25, makes call; then rinse and repeat

Third party middleware

  • Jitterbit, Boomi, Informatica, Mulesoft, etc.
| improve this answer | |
  • Thank you so much sir . – mukky Dec 12 '17 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.