{"record":{"id":"8aa44b40f470e49a","repo":"pentaho/pentaho-kettle","slug":"salesforceconnection-unabletofindobjecttype","errorCode":null,"errorMessage":"SalesforceConnection.UnableToFindObjectType","messagePattern":"SalesforceConnection\\.UnableToFindObjectType","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java","lineNumber":927,"sourceCode":"\n      int indexOfType = name.indexOf( \":\" );\n      if ( indexOfType > 0 ) {\n        String type = name.substring( 0, indexOfType );\n        String extIdName = null;\n        String lookupField = null;\n\n        String rest = name.substring( indexOfType + 1, name.length() );\n        int indexOfExtId = rest.indexOf( \"/\" );\n        if ( indexOfExtId > 0 ) {\n          extIdName = rest.substring( 0, indexOfExtId );\n          lookupField = rest.substring( indexOfExtId + 1, rest.length() );\n        } else {\n          extIdName = rest;\n          lookupField = extIdName;\n        }\n        me = createForeignKeyElement( type, lookupField, extIdName, value );\n      } else {\n        throw new KettleException( BaseMessages.getString( PKG, \"SalesforceConnection.UnableToFindObjectType\" ) );\n      }\n    } else {\n      me = fromTemplateElement( name, value, true );\n    }\n\n    return me;\n  }\n\n  private static XmlObject createForeignKeyElement( String type, String lookupField, String extIdName,\n    Object extIdValue ) throws Exception {\n\n    // Foreign key relationship to the object\n    XmlObject me = fromTemplateElement( lookupField, null, false );\n    me.addField( \"type\", type );\n    me.addField( extIdName, extIdValue );\n\n    return me;\n  }","sourceCodeStart":909,"sourceCodeEnd":945,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java#L909-L945","documentation":"SalesforceConnection throws this KettleException while building an upsert foreign-key element: it could not resolve the type of the value/object being looked up via the external ID field. The connection needs to know the Salesforce object type to construct the upsert element, and the supplied value did not correspond to any resolvable object type.","triggerScenarios":"Calling the connection's upsert/foreign-key element construction path with a value whose object type cannot be determined — e.g. the lookup value is not a recognized Salesforce object instance/type and the code falls into the final else branch.","commonSituations":"Upsert transformations pointing at an external ID field where the incoming data type doesn't map to a Salesforce object type; passing a plain string/value where a typed object is expected; typos in the lookup field configuration.","solutions":["Verify the upsert step's lookup/external ID field is configured with a valid Salesforce object type","Ensure the value passed to the connection is the expected object type (not a bare untyped value)","Check the field mapping in the transformation so the value's type matches the target Salesforce object","Enable detailed logging on the connection to see which value failed type resolution"],"exampleFix":"// before: passing an untyped value into the upsert element builder\nMessageElement me = connection.createForeignKeyElement(type, lookupField, extIdName, someString);\n// after: resolve/validate the object type first\nString objectType = connection.getObjectTypeFor(value);\nif (objectType == null) { throw new KettleException(\"Cannot resolve Salesforce object type for upsert value\"); }\nMessageElement me = connection.createForeignKeyElement(objectType, lookupField, extIdName, value);","handlingStrategy":"validation","validationCode":"// before calling the upsert element builder\nString objectType = connection.getObjectTypeFor(value);\nif (objectType == null || objectType.isEmpty()) {\n  throw new IllegalArgumentException(\"Cannot resolve Salesforce object type for value: \" + value);\n}","typeGuard":"// Java: narrow the value to a type that maps to a Salesforce object\nboolean isResolvableObjectType(Object value) {\n  return value != null && objectTypeRegistry.containsKey(value.getClass());\n}","tryCatchPattern":"try {\n  me = createForeignKeyElement(type, lookupField, extIdName, value);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"UnableToFindObjectType\")) {\n    logError(\"Object type could not be resolved for upsert value; check field mapping: \" + value);\n  }\n  throw e;\n}","preventionTips":["Always configure the target object type explicitly in the Salesforce upsert step","Map external ID fields to values with a resolvable Salesforce type","Preview the transformation data before running to confirm types resolve","Keep the Salesforce connection's object type cache refreshed"],"tags":["salesforce","upsert","object-type","kettle"],"backgroundTag":"invalid-argument-value","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"}