Method: Restforce::Concerns::API#upsert
- Defined in:
- lib/restforce/concerns/api.rb
#upsert(*args) ⇒ Object
Public: Update or create a record based on an external ID
sobject - The name of the sobject to created. field - The name of the external Id field to match against. attrs - Hash of attributes for the record.
Examples
# Update the record with external ID of 12
client.upsert('Account', 'External__c', External__c: 12, Name: 'Foobar')
Returns true if the record was found and updated. Returns the Id of the newly created record if the record was created. Returns false if something bad happens (for example if the external ID matches multiple resources).
341 342 343 344 345 |
# File 'lib/restforce/concerns/api.rb', line 341 def upsert(*args) upsert!(*args) rescue *exceptions false end |