{"record":{"id":"882f5f1aa3b917c1","repo":"pentaho/pentaho-kettle","slug":"salesforceinput-errordelete","errorCode":null,"errorMessage":"SalesforceInput.ErrorDelete","messagePattern":"SalesforceInput\\.ErrorDelete","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java","lineNumber":893,"sourceCode":"      return getBinding().create( normalizedSfBuffer.toArray( new SObject[normalizedSfBuffer.size()] ) );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.ErrorInsert\", e ) );\n    }\n  }\n\n  public SaveResult[] update( SObject[] sfBuffer ) throws KettleException {\n    try {\n      return getBinding().update( sfBuffer );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.ErrorUpdate\", e ) );\n    }\n  }\n\n  public DeleteResult[] delete( String[] id ) throws KettleException {\n    try {\n      return getBinding().delete( id );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"SalesforceInput.ErrorDelete\", e ) );\n    }\n  }\n\n  public static XmlObject createMessageElement( String name, Object value, boolean useExternalKey ) throws Exception {\n\n    XmlObject me = null;\n\n    if ( useExternalKey ) {\n      // We use an external key\n      // the structure should be like this :\n      // object:externalId/lookupField\n      // where\n      // object is the type of the object\n      // externalId is the name of the field in the object to resolve the value\n      // lookupField is the name of the field in the current object to update (is the \"__r\" version)\n\n      int indexOfType = name.indexOf( \":\" );\n      if ( indexOfType > 0 ) {","sourceCodeStart":875,"sourceCodeEnd":911,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java#L875-L911","documentation":"KettleException thrown by SalesforceConnection.delete() when the SOAP delete() call fails. The exception text is embedded in the message. It wraps transport-level failures of binding.delete(id) for the given record Id array.","triggerScenarios":"Calling delete(id) when the binding's delete() throws: invalid/empty Id array, invalid session, or permission failure on the object being deleted.","commonSituations":"Deleting records already deleted or belonging to another user without delete rights (INVALID_CROSS_REFERENCE_KEY), empty or malformed Ids passed from upstream rows, API user lacking Delete permission.","solutions":["Read the embedded Salesforce fault to see which Ids failed and why","Validate all Ids are non-null, well-formed 15/18-char Salesforce Ids before calling delete","Check Delete object permission for the integration user","Skip already-deleted records (query existence first or treat ENTITY_IS_DELETED as success)","Verify session validity / reconnect before retrying"],"exampleFix":"// before\nconnection.delete(ids); // ids may contain nulls from upstream\n// after\nString[] valid = Arrays.stream(ids).filter(i -> i != null && i.matches(\"[a-zA-Z0-9]{15,18}\")).toArray(String[]::new);\nif (valid.length > 0) connection.delete(valid);","handlingStrategy":"validation","validationCode":"boolean deletable = id != null && id.length > 0 && Arrays.stream(id).allMatch(i -> i != null && i.matches(\"[a-zA-Z0-9]{15,18}\")); if (!deletable) throw new IllegalArgumentException(\"delete() requires a non-empty array of valid Salesforce Ids\");","typeGuard":"boolean validIds(String[] ids) { return ids != null && ids.length > 0 && Arrays.stream(ids).allMatch(i -> i != null && i.length() >= 15); }","tryCatchPattern":"try { results = connection.delete(id); } catch (KettleException e) { log.logError(\"Delete failed: \" + e.getMessage(), e); throw e; } // fault text is in e.getMessage()","preventionTips":["Filter null/malformed Ids before calling delete()","Handle already-deleted records (ENTITY_IS_DELETED) as acceptable outcomes","Verify Delete permission for the integration user","Iterate DeleteResult[] for per-record success/error reporting","Reconnect if the session may have expired before the delete"],"tags":["salesforce","delete","api","data"],"backgroundTag":"api-error-response","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}