{"record":{"id":"ebc987a9c7104daa","repo":"pentaho/pentaho-kettle","slug":"salesforceinput-errorupdate","errorCode":null,"errorMessage":"SalesforceInput.ErrorUpdate","messagePattern":"SalesforceInput\\.ErrorUpdate","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java","lineNumber":885,"sourceCode":"  public SaveResult[] insert( SObject[] sfBuffer ) throws KettleException {\n    try {\n      List<SObject> normalizedSfBuffer = new ArrayList<>();\n      for ( SObject part : sfBuffer ) {\n        if ( part != null ) {\n          normalizedSfBuffer.add( part );\n        }\n      }\n      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 :","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java#L867-L903","documentation":"KettleException thrown by SalesforceConnection.update() when the SOAP update() call fails. The exception text is embedded in the message. Each SObject must carry a valid Id; transport or API rejection of the batch raises this error.","triggerScenarios":"Calling update(sfBuffer) when the binding's update() throws: SObjects without valid Salesforce record Ids, invalid session, field values failing validation rules, or permission errors.","commonSituations":"Updating records deleted by another process (INVALID_ID), missing Update permission, validation rules rejecting new field values, malformed date/number formats in changed fields.","solutions":["Read the embedded Salesforce fault — INVALID_FIELD/INVALID_ID point to the record Id or field issue","Verify every SObject Id is a valid, existing 18-char Salesforce Id","Check Update object permission and field-level update access for the integration user","Review org validation rules / triggers that may reject the new values","Retry with smaller batches to work around record-lock contention"],"exampleFix":"// before\nSObject o = new SObject(); o.setType(\"Account\"); o.setField(\"Name\",\"X\"); // no Id\nconnection.update(new SObject[]{o});\n// after\nSObject o = new SObject(); o.setType(\"Account\"); o.setId(\"001XXXXXXXXXXXXAAA\"); o.setField(\"Name\",\"X\");\nconnection.update(new SObject[]{o});","handlingStrategy":"validation","validationCode":"boolean updatable = Arrays.stream(sfBuffer).allMatch(o -> o != null && o.getId() != null && o.getId().matches(\"[a-zA-Z0-9]{15,18}\")); if (!updatable) throw new IllegalArgumentException(\"Every SObject needs a valid Salesforce Id before update()\");","typeGuard":"boolean hasValidIds(SObject[] buf) { return buf != null && Arrays.stream(buf).allMatch(o -> o.getId() != null && o.getId().length() >= 15); }","tryCatchPattern":"try { results = connection.update(buffer); } catch (KettleException e) { log.logError(\"Update failed: \" + e.getMessage(), e); throw e; } // fault text is in e.getMessage()","preventionTips":["Always set the record Id on each SObject before update()","Verify records still exist (not deleted by other processes) before updating","Check Update permission and field-level editability","Test new values against org validation rules before mass updates","Iterate SaveResult[] for per-record error handling"],"tags":["salesforce","update","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"}