function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MaxFrielMaxFriel 

InvalidJob:Operation cannot be specified

I am trying to use the bulk data api and keep getting a AsyncApiException kicked back with the excpetion code being Invalid Job and the exceptionMessage = 'Operation cannot be specified'.  What does that even mean?  I have tried this code with upsert/delete/insert/query/update.  I even commented out the ExternalIdFieldName setting when it wasn't an update or insert with no luck.  Any help would be much appreciated.  Here is the code...

            

String url = "https://" + conn.getServer() + ".salesforce.com/services/async/22.0/job";
			ConnectorConfig config = new ConnectorConfig();
			config.setSessionId(sesId);
			config.setRestEndpoint(url);
			config.setTraceMessage(true);
			BulkConnection bc = new BulkConnection(config);
			JobInfo job = new JobInfo();
			job.setObject(table);
			job.setExternalIdFieldName(extId);
			job.setOperation(OperationEnum.upsert);
			job.setContentType(ContentType.CSV);
			job = bc.createJob(job);
			System.out.println(job);

 

Best Answer chosen by Admin (Salesforce Developers) 
MaxFrielMaxFriel

Changed the first line to...

String url = "https://" + conn.getServer() + ".salesforce.com/services/async/23.0";

Problem solved