Comments (4)
@pbrondum what do you mean by 'cut off'? What was the error(s)?
There are at least 3 options for 100-1000 records - the standard Salesforce REST API currently only supports 1 insert per call. (I will open an enhancement request for better support within Swiftly Salesforce for multi-record inserts that implements 1+ of the options below.)
-
Use
when(fulfilled:)
with an array of 100-1000insert
methods as the argument. Note thatwhen
is aPromiseKit
method, so you'd need to importPromiseKit
in your code (it is already included as the sole dependency of Swiftly Salesforce) and the inserted records must all be of the same type. You can see examples ofwhen
here: http://promisekit.org/docs/ -
Use Swiftly Salesforce's
Salesforce.custom
method with the composite API endpoint and build the payload yourself. The composite API only supports up to 25 inserts, so you'd probably need to bundle these together in awhen
as above. And each sub-request 'costs' 1 API call, so there is no quota savings from using the composite API. See: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite.htm -
Use the
Salesforce.custom
method with the SOAP API endpoint to insert up to 200 records. I haven't tried this yet, so don't know for sure if it'd work.
If you are willing to poll for the asynchronous results, you could use the Bulk API to insert multiple records: https://resources.docs.salesforce.com/sfdc/pdf/api_asynch.pdf
from swiftlysalesforce.
from swiftlysalesforce.
@pbrondum try creating an array of promises from ALL_TEMPLATES
with map
and then use that array as the argument to when
-- something like this:
import PromiseKit
...
let promises = ALL_TEMPLATES.map {
template in
let fields = ...
return salesforce.insert(type: "WiWo_Template__c", fields: fields)
}
when(fulfilled: promises).then {
// Do something with the results
}.catch {
// Handle error
}
from swiftlysalesforce.
from swiftlysalesforce.
Related Issues (20)
- Enhance SOSL to support AnyPublisher<QueryResult<T> HOT 6
- Login not working after dismissed HOT 1
- Question: Best practices for querying if user is allowed to update object HOT 1
- Composite resources support HOT 2
- MyRecords() func assumes object has 'ownerId' column HOT 8
- Login migration path for Swift Apps HOT 6
- Support for Anonymous Apex? HOT 7
- Error in fields array: Protocol 'Encodable' as a type cannot conform to the protocol itself HOT 7
- salesforce.search() replacement? in 9.0 HOT 2
- 'group by' count() soql fails in 9.0 HOT 26
- WebAuthenticator.swift:50:30: 'shared' is unavailable in application extensions for iOS HOT 1
- keyNotFound "id" error on simple query HOT 7
- Query with date predicate fail HOT 8
- Minor doc bug HOT 1
- Is there another way to perform salesforce.nextResultPage in V10? HOT 6
- Update links in README.md so they point to latest code version
- Adding SwiftlySalesforce to new project adds V8.0 (master) HOT 4
- Add ability to save files to SFDC & share via Chatter/Slack
- Implementation in ipad Swift Playground. AuthenticationError HOT 3
- README OATH screenshot needs refresh HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftlysalesforce.