public void updateSample(String id) {
    try {
      // Create an sObject of type contact
      SObject updateContact = new SObject();
      updateContact.setType("Contact");

      // Set the ID of the contact to update
      updateContact.setId(id);
      // Set the Phone field with a new value
      updateContact.setField("Phone", "(415) 555-1212");

      // Create another contact that will cause an error
      // because it has an invalid ID.
      SObject errorContact = new SObject();
      errorContact.setType("Contact");
      // Set an invalid ID on purpose
      errorContact.setId("SLFKJLFKJ");
      // Set the value of LastName to null
      errorContact.setFieldsToNull(new String[] {"LastName"});

      // Make the update call by passing an array containing
      // the two objects.
      SaveResult[] saveResults =
          partnerConnection.update(new SObject[] {updateContact, errorContact});
      // Iterate through the results and write the ID of
      // the updated contacts to the console, in this case one contact.
      // If the result is not successful, write the errors
      // to the console. In this case, one item failed to update.
      for (int j = 0; j < saveResults.length; j++) {
        System.out.println("\nItem: " + j);
        if (saveResults[j].isSuccess()) {
          System.out.println("Contact with an ID of " + saveResults[j].getId() + " was updated.");
        } else {
          // There were errors during the update call,
          // go through the errors array and write
          // them to the console.
          for (int i = 0; i < saveResults[j].getErrors().length; i++) {
            Error err = saveResults[j].getErrors()[i];
            System.out.println("Errors were found on item " + j);
            System.out.println("Error code: " + err.getStatusCode().toString());
            System.out.println("Error message: " + err.getMessage());
          }
        }
      }
    } catch (ConnectionException ce) {
      ce.printStackTrace();
    }
  }
  public String createSample() {
    String result = null;
    try {
      // Create a new sObject of type Contact
      // and fill out its fields.
      SObject contact = new SObject();
      contact.setType("Contact");
      contact.setField("FirstName", "Otto");
      contact.setField("LastName", "Jespersen");
      contact.setField("Salutation", "Professor");
      contact.setField("Phone", "(999) 555-1234");
      contact.setField("Title", "Philologist");

      // Add this sObject to an array
      SObject[] contacts = new SObject[1];
      contacts[0] = contact;
      // Make a create call and pass it the array of sObjects
      SaveResult[] results = partnerConnection.create(contacts);

      // Iterate through the results list
      // and write the ID of the new sObject
      // or the errors if the object creation failed.
      // In this case, we only have one result
      // since we created one contact.
      for (int j = 0; j < results.length; j++) {
        if (results[j].isSuccess()) {
          result = results[j].getId();
          System.out.println("\nA contact was created with an ID of: " + result);
        } else {
          // There were errors during the create call,
          // go through the errors array and write
          // them to the console
          for (int i = 0; i < results[j].getErrors().length; i++) {
            Error err = results[j].getErrors()[i];
            System.out.println("Errors were found on item " + j);
            System.out.println("Error code: " + err.getStatusCode().toString());
            System.out.println("Error message: " + err.getMessage());
          }
        }
      }
    } catch (ConnectionException ce) {
      ce.printStackTrace();
    }
    return result;
  }
  private void flushBuffers() throws KettleException {

    try {
      // create the object(s) by sending the array to the web service
      data.saveResult = data.connection.update(data.sfBuffer);
      int nr = data.saveResult.length;
      for (int j = 0; j < nr; j++) {
        if (data.saveResult[j].isSuccess()) {
          // Row was updated
          String id = data.saveResult[j].getId();
          if (log.isDetailed()) {
            logDetailed("Row updated with id: " + id);
          }

          // write out the row with the SalesForce ID
          Object[] newRow =
              RowDataUtil.resizeArray(data.outputBuffer[j], data.outputRowMeta.size());

          if (log.isDetailed()) {
            logDetailed("The new row has an id value of : " + newRow[0]);
          }

          putRow(data.outputRowMeta, newRow); // copy row to output rowset(s);
          incrementLinesUpdated();

          if (checkFeedback(getLinesInput())) {
            if (log.isDetailed()) {
              logDetailed(
                  BaseMessages.getString(
                      PKG, "SalesforceUpdate.log.LineRow", "" + getLinesInput()));
            }
          }

        } else {
          // there were errors during the create call, go through the
          // errors
          // array and write them to the screen

          if (!getStepMeta().isDoingErrorHandling()) {
            if (log.isDetailed()) {
              logDetailed("Found error from SalesForce and raising the exception");
            }

            // Only send the first error
            //
            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[0];
            throw new KettleException(
                BaseMessages.getString(
                    PKG,
                    "SalesforceUpdate.Error.FlushBuffer",
                    new Integer(j),
                    err.getStatusCode(),
                    err.getMessage()));
          }

          String errorMessage = "";
          for (int i = 0; i < data.saveResult[j].getErrors().length; i++) {
            // get the next error
            com.sforce.soap.partner.Error err = data.saveResult[j].getErrors()[i];
            errorMessage +=
                BaseMessages.getString(
                    PKG,
                    "SalesforceUpdate.Error.FlushBuffer",
                    new Integer(j),
                    err.getStatusCode(),
                    err.getMessage());
          }

          // Simply add this row to the error row
          if (log.isDebug()) {
            logDebug("Passing row to error step");
          }

          putError(
              getInputRowMeta(),
              data.outputBuffer[j],
              1,
              errorMessage,
              null,
              "SalesforceUpdate001");
        }
      }

      // reset the buffers
      data.sfBuffer = new SObject[meta.getBatchSizeInt()];
      data.outputBuffer = new Object[meta.getBatchSizeInt()][];
      data.iBufferPos = 0;

    } catch (Exception e) {
      if (!getStepMeta().isDoingErrorHandling()) {
        throw new KettleException(
            "\nFailed to update object, error message was: \n" + e.getMessage());
      }

      // Simply add this row to the error row
      if (log.isDebug()) {
        logDebug("Passing row to error step");
      }

      for (int i = 0; i < data.iBufferPos; i++) {
        putError(
            data.inputRowMeta,
            data.outputBuffer[i],
            1,
            e.getMessage(),
            null,
            "SalesforceUpdate002");
      }

    } finally {
      if (data.saveResult != null) {
        data.saveResult = null;
      }
    }
  }
  private void flushBuffers() throws KettleException {

    try {
      // create the object(s) by sending the array to the web service
      data.deleteResult = data.connection.delete(data.deleteId);
      int nr = data.deleteResult.length;
      for (int j = 0; j < nr; j++) {
        if (data.deleteResult[j].isSuccess()) {

          putRow(data.outputRowMeta, data.outputBuffer[j]); // copy row to output rowset(s);
          incrementLinesOutput();

          if (checkFeedback(getLinesInput())) {
            if (log.isDetailed())
              logDetailed(
                  BaseMessages.getString(
                      PKG, "SalesforceDelete.log.LineRow", String.valueOf(getLinesInput())));
          }

        } else {
          // there were errors during the create call, go through the
          // errors
          // array and write them to the screen

          if (!getStepMeta().isDoingErrorHandling()) {
            if (log.isDetailed())
              logDetailed(BaseMessages.getString(PKG, "SalesforceDelete.Found.Error"));

            com.sforce.soap.partner.Error err = data.deleteResult[j].getErrors()[0];
            throw new KettleException(
                BaseMessages.getString(
                    PKG,
                    "SalesforceDelete.Error.FlushBuffer",
                    new Integer(j),
                    err.getStatusCode(),
                    err.getMessage()));
          }
          String errorMessage = "";
          int nrErrors = data.deleteResult[j].getErrors().length;
          for (int i = 0; i < nrErrors; i++) {
            // get the next error
            com.sforce.soap.partner.Error err = data.deleteResult[j].getErrors()[i];
            errorMessage +=
                BaseMessages.getString(
                    PKG,
                    "SalesforceDelete.Error.FlushBuffer",
                    new Integer(j),
                    err.getStatusCode(),
                    err.getMessage());
          }
          // Simply add this row to the error row
          if (log.isDebug())
            logDebug(BaseMessages.getString(PKG, "SalesforceDelete.PassingRowToErrorStep"));
          putError(
              getInputRowMeta(),
              data.outputBuffer[j],
              1,
              errorMessage,
              null,
              "SalesforceDelete001");
        }
      }

      // reset the buffers
      data.deleteId = new String[meta.getBatchSizeInt()];
      data.outputBuffer = new Object[meta.getBatchSizeInt()][];
      data.iBufferPos = 0;

    } catch (Exception e) {
      if (!getStepMeta().isDoingErrorHandling()) {
        throw new KettleException(
            BaseMessages.getString(PKG, "SalesforceDelete.FailedToDeleted", e.getMessage()));
      }
      // Simply add this row to the error row
      if (log.isDebug()) logDebug("Passing row to error step");

      for (int i = 0; i < data.iBufferPos; i++) {
        putError(
            data.inputRowMeta,
            data.outputBuffer[i],
            1,
            e.getMessage(),
            null,
            "SalesforceDelete002");
      }
    } finally {
      if (data.deleteResult != null) data.deleteResult = null;
    }
  }