class Multiwoven::Integrations::Destination::SalesforceCrm::Client

def process_records(records, stream)

def process_records(records, stream)
  write_success = 0
  write_failure = 0
  properties = stream.json_schema[:properties]
  records.each do |record_object|
    record = extract_data(record_object, properties)
    process_record(stream, record)
    write_success += 1
  rescue StandardError => e
    # TODO: add sync_id and sync_run_id to the logs
    handle_exception(e, {
                       context: "SALESFORCE:CRM:WRITE:EXCEPTION",
                       type: "error",
                       sync_id: @sync_config.sync_id,
                       sync_run_id: @sync_config.sync_run_id
                     })
    write_failure += 1
  end
  tracking_message(write_success, write_failure)
end