Bulk API v2 Get Job Status Failing - InvalidBatch : Field name not found The Next CEO of Stack Overflow2019 Community Moderator ElectionWhy is my WebToLead form not submitting?Bulk-API: How to add a batch with both CSV data and a query?API Call out to a Vendor Product from Batch JobRetrieving status from bulk job load?Publish Status Rest Api call Fails with Not FoundProcess Builder - Clone - Deleted Or Renamed Field (API Name)Bulk Api error InvalidBatch : Field name not foundCreating a new sandbox using the Tooling API with .NETCan I get assistance on how to set up Bulk/Batch insert?Trouble with Creating a Job for Bulk API 2.0

Sending manuscript to multiple publishers

What is the result of assigning to std::vector<T>::begin()?

Is there a difference between "Fahrstuhl" and "Aufzug"

What benefits would be gained by using human laborers instead of drones in deep sea mining?

How do I make a variable always equal to the result of some calculations?

Would a completely good Muggle be able to use a wand?

Can I run my washing machine drain line into a condensate pump so it drains better?

Complex fractions

If a black hole is created from light, can this black hole then move at speed of light?

Why am I allowed to create multiple unique pointers from a single object?

Why does standard notation not preserve intervals (visually)

How to prevent changing the value of variable?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Why didn't Khan get resurrected in the Genesis Explosion?

How did people program for Consoles with multiple CPUs?

Inappropriate reference requests from Journal reviewers

Why do we use the plural of movies in this phrase "We went to the movies last night."?

Several mode to write the symbol of a vector

Contours of a clandestine nature

Why does the UK parliament need a vote on the political declaration?

Is it possible to search for a directory/file combination?

Preparing Indesign booklet with .psd graphics for print

sp_blitzCache results Memory grants

Multiple labels for a single equation



Bulk API v2 Get Job Status Failing - InvalidBatch : Field name not found



The Next CEO of Stack Overflow
2019 Community Moderator ElectionWhy is my WebToLead form not submitting?Bulk-API: How to add a batch with both CSV data and a query?API Call out to a Vendor Product from Batch JobRetrieving status from bulk job load?Publish Status Rest Api call Fails with Not FoundProcess Builder - Clone - Deleted Or Renamed Field (API Name)Bulk Api error InvalidBatch : Field name not foundCreating a new sandbox using the Tooling API with .NETCan I get assistance on how to set up Bulk/Batch insert?Trouble with Creating a Job for Bulk API 2.0










4















I've been beating my head against the wall of the Salesforce Bulk API v2.0 for a couple of weeks now and I'm at my wits end.



I've been able to use Postman to test most of the calls and they appear to be working with correct values being returned. I can login, create a job, upload a file, close the job, and check the status all in Postman and it works correctly.



I can duplicate this code in C# and it all works as expected until I try to check the status of the job. At that point it returns this error, along with the normal fields.



"InvalidBatch : InvalidBatch : Field name not found : ", there is no field name listed as I have seen on other posts.



I've double checked the session token, the url, the http method, and the headers. Everything appears to be normal and matches what I'm using in Postman with the obvious values replaced.



This is the url I'm calling to return the job status, https://instance.my.salesforce.com/services/data/v45.0/jobs/ingest/jobID. This matches the documentation and all samples I've found.



Here is the JSON returned from this call, job id, created by, object have been removed for this post.




"operation": "insert",
"createdDate": "2019-03-27T19:08:46.000+0000",
"systemModstamp": "2019-03-27T19:08:52.000+0000",
"state": "Failed",
"concurrencyMode": "Parallel",
"contentType": "CSV",
"apiVersion": 45.0,
"jobType": "V2Ingest",
"lineEnding": "CRLF",
"columnDelimiter": "COMMA",
"numberRecordsProcessed": 0,
"numberRecordsFailed": 0,
"retries": 0,
"totalProcessingTime": 0,
"apiActiveProcessingTime": 0,
"apexProcessingTime": 0,
"errorMessage": "InvalidBatch : InvalidBatch : Field name not found : --e52c6b94-9d37-4eda-b096-59d96b7e0cb5"



I've double, triple checked the column names I'm sending in the CSV file header record, they all match. Plus if they didn't, then Postman would also fail.



Our resident internet guru is also at a loss as to why this isn't working. Here is the code I'm using to return the job status.



client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")));
Task<HttpResponseMessage> responseMessage = client.SendAsync(request);
Task<string> response = responseMessage.GetAwaiter().GetResult().Content.ReadAsStringAsync();


I've been through the Saleforce documents, tutorials, and many other C# examples. I haven't been able to determine the issue.



I've searched the internet high and low and I can't find anything resembling this issue.



The only thing I can think of is the Salesforce consultant wanted me to embed a CRLF into our address lines so the complete street address would be in one field. But I don't know why that would be ok when using Postman but not ok when running from code.



If any one has any ideas, I'd really appreciate it.



Edit: I can confirm is it not the CRLF embedded in the street address. I've swapped between CR, LF, CRLF, or no character at all, no difference.



Edit: To be perfectly clear the job is being flagged as failed as soon as I close the job. To do that call a PATCH with a body of "state" : "UploadComplete" .










share|improve this question









New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

    – Pranay Jaiswal
    yesterday












  • @pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

    – Steve D.
    yesterday















4















I've been beating my head against the wall of the Salesforce Bulk API v2.0 for a couple of weeks now and I'm at my wits end.



I've been able to use Postman to test most of the calls and they appear to be working with correct values being returned. I can login, create a job, upload a file, close the job, and check the status all in Postman and it works correctly.



I can duplicate this code in C# and it all works as expected until I try to check the status of the job. At that point it returns this error, along with the normal fields.



"InvalidBatch : InvalidBatch : Field name not found : ", there is no field name listed as I have seen on other posts.



I've double checked the session token, the url, the http method, and the headers. Everything appears to be normal and matches what I'm using in Postman with the obvious values replaced.



This is the url I'm calling to return the job status, https://instance.my.salesforce.com/services/data/v45.0/jobs/ingest/jobID. This matches the documentation and all samples I've found.



Here is the JSON returned from this call, job id, created by, object have been removed for this post.




"operation": "insert",
"createdDate": "2019-03-27T19:08:46.000+0000",
"systemModstamp": "2019-03-27T19:08:52.000+0000",
"state": "Failed",
"concurrencyMode": "Parallel",
"contentType": "CSV",
"apiVersion": 45.0,
"jobType": "V2Ingest",
"lineEnding": "CRLF",
"columnDelimiter": "COMMA",
"numberRecordsProcessed": 0,
"numberRecordsFailed": 0,
"retries": 0,
"totalProcessingTime": 0,
"apiActiveProcessingTime": 0,
"apexProcessingTime": 0,
"errorMessage": "InvalidBatch : InvalidBatch : Field name not found : --e52c6b94-9d37-4eda-b096-59d96b7e0cb5"



I've double, triple checked the column names I'm sending in the CSV file header record, they all match. Plus if they didn't, then Postman would also fail.



Our resident internet guru is also at a loss as to why this isn't working. Here is the code I'm using to return the job status.



client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")));
Task<HttpResponseMessage> responseMessage = client.SendAsync(request);
Task<string> response = responseMessage.GetAwaiter().GetResult().Content.ReadAsStringAsync();


I've been through the Saleforce documents, tutorials, and many other C# examples. I haven't been able to determine the issue.



I've searched the internet high and low and I can't find anything resembling this issue.



The only thing I can think of is the Salesforce consultant wanted me to embed a CRLF into our address lines so the complete street address would be in one field. But I don't know why that would be ok when using Postman but not ok when running from code.



If any one has any ideas, I'd really appreciate it.



Edit: I can confirm is it not the CRLF embedded in the street address. I've swapped between CR, LF, CRLF, or no character at all, no difference.



Edit: To be perfectly clear the job is being flagged as failed as soon as I close the job. To do that call a PATCH with a body of "state" : "UploadComplete" .










share|improve this question









New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

    – Pranay Jaiswal
    yesterday












  • @pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

    – Steve D.
    yesterday













4












4








4


1






I've been beating my head against the wall of the Salesforce Bulk API v2.0 for a couple of weeks now and I'm at my wits end.



I've been able to use Postman to test most of the calls and they appear to be working with correct values being returned. I can login, create a job, upload a file, close the job, and check the status all in Postman and it works correctly.



I can duplicate this code in C# and it all works as expected until I try to check the status of the job. At that point it returns this error, along with the normal fields.



"InvalidBatch : InvalidBatch : Field name not found : ", there is no field name listed as I have seen on other posts.



I've double checked the session token, the url, the http method, and the headers. Everything appears to be normal and matches what I'm using in Postman with the obvious values replaced.



This is the url I'm calling to return the job status, https://instance.my.salesforce.com/services/data/v45.0/jobs/ingest/jobID. This matches the documentation and all samples I've found.



Here is the JSON returned from this call, job id, created by, object have been removed for this post.




"operation": "insert",
"createdDate": "2019-03-27T19:08:46.000+0000",
"systemModstamp": "2019-03-27T19:08:52.000+0000",
"state": "Failed",
"concurrencyMode": "Parallel",
"contentType": "CSV",
"apiVersion": 45.0,
"jobType": "V2Ingest",
"lineEnding": "CRLF",
"columnDelimiter": "COMMA",
"numberRecordsProcessed": 0,
"numberRecordsFailed": 0,
"retries": 0,
"totalProcessingTime": 0,
"apiActiveProcessingTime": 0,
"apexProcessingTime": 0,
"errorMessage": "InvalidBatch : InvalidBatch : Field name not found : --e52c6b94-9d37-4eda-b096-59d96b7e0cb5"



I've double, triple checked the column names I'm sending in the CSV file header record, they all match. Plus if they didn't, then Postman would also fail.



Our resident internet guru is also at a loss as to why this isn't working. Here is the code I'm using to return the job status.



client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")));
Task<HttpResponseMessage> responseMessage = client.SendAsync(request);
Task<string> response = responseMessage.GetAwaiter().GetResult().Content.ReadAsStringAsync();


I've been through the Saleforce documents, tutorials, and many other C# examples. I haven't been able to determine the issue.



I've searched the internet high and low and I can't find anything resembling this issue.



The only thing I can think of is the Salesforce consultant wanted me to embed a CRLF into our address lines so the complete street address would be in one field. But I don't know why that would be ok when using Postman but not ok when running from code.



If any one has any ideas, I'd really appreciate it.



Edit: I can confirm is it not the CRLF embedded in the street address. I've swapped between CR, LF, CRLF, or no character at all, no difference.



Edit: To be perfectly clear the job is being flagged as failed as soon as I close the job. To do that call a PATCH with a body of "state" : "UploadComplete" .










share|improve this question









New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I've been beating my head against the wall of the Salesforce Bulk API v2.0 for a couple of weeks now and I'm at my wits end.



I've been able to use Postman to test most of the calls and they appear to be working with correct values being returned. I can login, create a job, upload a file, close the job, and check the status all in Postman and it works correctly.



I can duplicate this code in C# and it all works as expected until I try to check the status of the job. At that point it returns this error, along with the normal fields.



"InvalidBatch : InvalidBatch : Field name not found : ", there is no field name listed as I have seen on other posts.



I've double checked the session token, the url, the http method, and the headers. Everything appears to be normal and matches what I'm using in Postman with the obvious values replaced.



This is the url I'm calling to return the job status, https://instance.my.salesforce.com/services/data/v45.0/jobs/ingest/jobID. This matches the documentation and all samples I've found.



Here is the JSON returned from this call, job id, created by, object have been removed for this post.




"operation": "insert",
"createdDate": "2019-03-27T19:08:46.000+0000",
"systemModstamp": "2019-03-27T19:08:52.000+0000",
"state": "Failed",
"concurrencyMode": "Parallel",
"contentType": "CSV",
"apiVersion": 45.0,
"jobType": "V2Ingest",
"lineEnding": "CRLF",
"columnDelimiter": "COMMA",
"numberRecordsProcessed": 0,
"numberRecordsFailed": 0,
"retries": 0,
"totalProcessingTime": 0,
"apiActiveProcessingTime": 0,
"apexProcessingTime": 0,
"errorMessage": "InvalidBatch : InvalidBatch : Field name not found : --e52c6b94-9d37-4eda-b096-59d96b7e0cb5"



I've double, triple checked the column names I'm sending in the CSV file header record, they all match. Plus if they didn't, then Postman would also fail.



Our resident internet guru is also at a loss as to why this isn't working. Here is the code I'm using to return the job status.



client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")));
Task<HttpResponseMessage> responseMessage = client.SendAsync(request);
Task<string> response = responseMessage.GetAwaiter().GetResult().Content.ReadAsStringAsync();


I've been through the Saleforce documents, tutorials, and many other C# examples. I haven't been able to determine the issue.



I've searched the internet high and low and I can't find anything resembling this issue.



The only thing I can think of is the Salesforce consultant wanted me to embed a CRLF into our address lines so the complete street address would be in one field. But I don't know why that would be ok when using Postman but not ok when running from code.



If any one has any ideas, I'd really appreciate it.



Edit: I can confirm is it not the CRLF embedded in the street address. I've swapped between CR, LF, CRLF, or no character at all, no difference.



Edit: To be perfectly clear the job is being flagged as failed as soon as I close the job. To do that call a PATCH with a body of "state" : "UploadComplete" .







api c# bulk






share|improve this question









New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday







Steve D.













New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Steve D.Steve D.

514




514




New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

    – Pranay Jaiswal
    yesterday












  • @pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

    – Steve D.
    yesterday

















  • Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

    – Pranay Jaiswal
    yesterday












  • @pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

    – Steve D.
    yesterday
















Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

– Pranay Jaiswal
yesterday






Can you print and see whats the value of BulkEndPoint + ContentUrl.Substring(0, ContentUrl.IndexOf("/batches")

– Pranay Jaiswal
yesterday














@pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

– Steve D.
yesterday





@pranay-jaiswal, it's the same as the link I posted in the question. I double checked this just now. ag.my.salesforce.com/services/data/v45.0/jobs/ingest/….

– Steve D.
yesterday










1 Answer
1






active

oldest

votes


















3














Problem resolved!




"operation": "insert",
"createdDate": "2019-03-28T19:40:38.000+0000",
"systemModstamp": "2019-03-28T19:41:34.000+0000",
"state": "JobComplete",
"concurrencyMode": "Parallel",
"contentType": "CSV",
"apiVersion": 45.0,
"jobType": "V2Ingest",
"lineEnding": "CRLF",
"columnDelimiter": "COMMA",
"numberRecordsProcessed": 883,
"numberRecordsFailed": 809,
"retries": 0,
"totalProcessingTime": 11210,
"apiActiveProcessingTime": 10847,
"apexProcessingTime": 0



Just in case anyone else runs into this same issue. I didn't find this information anywhere, I just kept modifying the code until I got it working. The issue for me was how the CSV file was being uploaded to Salesforce.



This was my original code.



MultipartFormDataContent content = new MultipartFormDataContent()

Headers =

ContentType = new MediaTypeHeaderValue("text/csv")

;

client.DefaultRequestHeaders.Accept.Clear();

using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

StreamContent streamContent = new StreamContent(fs);
streamContent.Headers.Add("Content-Type", "application/octet-stream");
streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
content.Add(streamContent);
Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, content);
var result = responseMessage.Result.Content.ReadAsStringAsync();
string resultString = result.Result;



I'm guessing it didn't like the headers for the content, streamContent variables.



The new code, this still uploads the file, but doesn't fail when the job is closed. And as shown above, the return JSON from the job info no longer has an error message. This contradicts the examples I was able to find about uploading files to Salesforce using the bulk API v2.0.



// We don't want any weird headers hanging around
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Add("Accept", "application/json");

using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

StreamContent streamContent = new StreamContent(fs);
streamContent.Headers.Add("Content-Type", "text/csv");
//streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, streamContent);
var result = responseMessage.Result.Content.ReadAsStringAsync();
string resultString = result.Result;






share|improve this answer








New contributor




Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "459"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Steve D. is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f255712%2fbulk-api-v2-get-job-status-failing-invalidbatch-field-name-not-found%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Problem resolved!




    "operation": "insert",
    "createdDate": "2019-03-28T19:40:38.000+0000",
    "systemModstamp": "2019-03-28T19:41:34.000+0000",
    "state": "JobComplete",
    "concurrencyMode": "Parallel",
    "contentType": "CSV",
    "apiVersion": 45.0,
    "jobType": "V2Ingest",
    "lineEnding": "CRLF",
    "columnDelimiter": "COMMA",
    "numberRecordsProcessed": 883,
    "numberRecordsFailed": 809,
    "retries": 0,
    "totalProcessingTime": 11210,
    "apiActiveProcessingTime": 10847,
    "apexProcessingTime": 0



    Just in case anyone else runs into this same issue. I didn't find this information anywhere, I just kept modifying the code until I got it working. The issue for me was how the CSV file was being uploaded to Salesforce.



    This was my original code.



    MultipartFormDataContent content = new MultipartFormDataContent()

    Headers =

    ContentType = new MediaTypeHeaderValue("text/csv")

    ;

    client.DefaultRequestHeaders.Accept.Clear();

    using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

    StreamContent streamContent = new StreamContent(fs);
    streamContent.Headers.Add("Content-Type", "application/octet-stream");
    streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
    content.Add(streamContent);
    Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, content);
    var result = responseMessage.Result.Content.ReadAsStringAsync();
    string resultString = result.Result;



    I'm guessing it didn't like the headers for the content, streamContent variables.



    The new code, this still uploads the file, but doesn't fail when the job is closed. And as shown above, the return JSON from the job info no longer has an error message. This contradicts the examples I was able to find about uploading files to Salesforce using the bulk API v2.0.



    // We don't want any weird headers hanging around
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Add("Accept", "application/json");

    using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

    StreamContent streamContent = new StreamContent(fs);
    streamContent.Headers.Add("Content-Type", "text/csv");
    //streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
    Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, streamContent);
    var result = responseMessage.Result.Content.ReadAsStringAsync();
    string resultString = result.Result;






    share|improve this answer








    New contributor




    Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      3














      Problem resolved!




      "operation": "insert",
      "createdDate": "2019-03-28T19:40:38.000+0000",
      "systemModstamp": "2019-03-28T19:41:34.000+0000",
      "state": "JobComplete",
      "concurrencyMode": "Parallel",
      "contentType": "CSV",
      "apiVersion": 45.0,
      "jobType": "V2Ingest",
      "lineEnding": "CRLF",
      "columnDelimiter": "COMMA",
      "numberRecordsProcessed": 883,
      "numberRecordsFailed": 809,
      "retries": 0,
      "totalProcessingTime": 11210,
      "apiActiveProcessingTime": 10847,
      "apexProcessingTime": 0



      Just in case anyone else runs into this same issue. I didn't find this information anywhere, I just kept modifying the code until I got it working. The issue for me was how the CSV file was being uploaded to Salesforce.



      This was my original code.



      MultipartFormDataContent content = new MultipartFormDataContent()

      Headers =

      ContentType = new MediaTypeHeaderValue("text/csv")

      ;

      client.DefaultRequestHeaders.Accept.Clear();

      using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

      StreamContent streamContent = new StreamContent(fs);
      streamContent.Headers.Add("Content-Type", "application/octet-stream");
      streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
      content.Add(streamContent);
      Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, content);
      var result = responseMessage.Result.Content.ReadAsStringAsync();
      string resultString = result.Result;



      I'm guessing it didn't like the headers for the content, streamContent variables.



      The new code, this still uploads the file, but doesn't fail when the job is closed. And as shown above, the return JSON from the job info no longer has an error message. This contradicts the examples I was able to find about uploading files to Salesforce using the bulk API v2.0.



      // We don't want any weird headers hanging around
      client.DefaultRequestHeaders.Accept.Clear();
      client.DefaultRequestHeaders.Add("Accept", "application/json");

      using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

      StreamContent streamContent = new StreamContent(fs);
      streamContent.Headers.Add("Content-Type", "text/csv");
      //streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
      Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, streamContent);
      var result = responseMessage.Result.Content.ReadAsStringAsync();
      string resultString = result.Result;






      share|improve this answer








      New contributor




      Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        3












        3








        3







        Problem resolved!




        "operation": "insert",
        "createdDate": "2019-03-28T19:40:38.000+0000",
        "systemModstamp": "2019-03-28T19:41:34.000+0000",
        "state": "JobComplete",
        "concurrencyMode": "Parallel",
        "contentType": "CSV",
        "apiVersion": 45.0,
        "jobType": "V2Ingest",
        "lineEnding": "CRLF",
        "columnDelimiter": "COMMA",
        "numberRecordsProcessed": 883,
        "numberRecordsFailed": 809,
        "retries": 0,
        "totalProcessingTime": 11210,
        "apiActiveProcessingTime": 10847,
        "apexProcessingTime": 0



        Just in case anyone else runs into this same issue. I didn't find this information anywhere, I just kept modifying the code until I got it working. The issue for me was how the CSV file was being uploaded to Salesforce.



        This was my original code.



        MultipartFormDataContent content = new MultipartFormDataContent()

        Headers =

        ContentType = new MediaTypeHeaderValue("text/csv")

        ;

        client.DefaultRequestHeaders.Accept.Clear();

        using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

        StreamContent streamContent = new StreamContent(fs);
        streamContent.Headers.Add("Content-Type", "application/octet-stream");
        streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
        content.Add(streamContent);
        Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, content);
        var result = responseMessage.Result.Content.ReadAsStringAsync();
        string resultString = result.Result;



        I'm guessing it didn't like the headers for the content, streamContent variables.



        The new code, this still uploads the file, but doesn't fail when the job is closed. And as shown above, the return JSON from the job info no longer has an error message. This contradicts the examples I was able to find about uploading files to Salesforce using the bulk API v2.0.



        // We don't want any weird headers hanging around
        client.DefaultRequestHeaders.Accept.Clear();
        client.DefaultRequestHeaders.Add("Accept", "application/json");

        using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

        StreamContent streamContent = new StreamContent(fs);
        streamContent.Headers.Add("Content-Type", "text/csv");
        //streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
        Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, streamContent);
        var result = responseMessage.Result.Content.ReadAsStringAsync();
        string resultString = result.Result;






        share|improve this answer








        New contributor




        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        Problem resolved!




        "operation": "insert",
        "createdDate": "2019-03-28T19:40:38.000+0000",
        "systemModstamp": "2019-03-28T19:41:34.000+0000",
        "state": "JobComplete",
        "concurrencyMode": "Parallel",
        "contentType": "CSV",
        "apiVersion": 45.0,
        "jobType": "V2Ingest",
        "lineEnding": "CRLF",
        "columnDelimiter": "COMMA",
        "numberRecordsProcessed": 883,
        "numberRecordsFailed": 809,
        "retries": 0,
        "totalProcessingTime": 11210,
        "apiActiveProcessingTime": 10847,
        "apexProcessingTime": 0



        Just in case anyone else runs into this same issue. I didn't find this information anywhere, I just kept modifying the code until I got it working. The issue for me was how the CSV file was being uploaded to Salesforce.



        This was my original code.



        MultipartFormDataContent content = new MultipartFormDataContent()

        Headers =

        ContentType = new MediaTypeHeaderValue("text/csv")

        ;

        client.DefaultRequestHeaders.Accept.Clear();

        using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

        StreamContent streamContent = new StreamContent(fs);
        streamContent.Headers.Add("Content-Type", "application/octet-stream");
        streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
        content.Add(streamContent);
        Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, content);
        var result = responseMessage.Result.Content.ReadAsStringAsync();
        string resultString = result.Result;



        I'm guessing it didn't like the headers for the content, streamContent variables.



        The new code, this still uploads the file, but doesn't fail when the job is closed. And as shown above, the return JSON from the job info no longer has an error message. This contradicts the examples I was able to find about uploading files to Salesforce using the bulk API v2.0.



        // We don't want any weird headers hanging around
        client.DefaultRequestHeaders.Accept.Clear();
        client.DefaultRequestHeaders.Add("Accept", "application/json");

        using (FileStream fs = new FileStream(UploadFileType.FilePath, FileMode.Open, FileAccess.Read))

        StreamContent streamContent = new StreamContent(fs);
        streamContent.Headers.Add("Content-Type", "text/csv");
        //streamContent.Headers.Add("Content-Disposition", "form-data; name="file"; filename="" + Path.GetFileName(UploadFileType.FilePath) + """);
        Task<HttpResponseMessage> responseMessage = client.PutAsync(BulkEndPoint + ContentUrl, streamContent);
        var result = responseMessage.Result.Content.ReadAsStringAsync();
        string resultString = result.Result;







        share|improve this answer








        New contributor




        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered yesterday









        Steve D.Steve D.

        514




        514




        New contributor




        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Steve D. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




















            Steve D. is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Steve D. is a new contributor. Be nice, and check out our Code of Conduct.












            Steve D. is a new contributor. Be nice, and check out our Code of Conduct.











            Steve D. is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Salesforce Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f255712%2fbulk-api-v2-get-job-status-failing-invalidbatch-field-name-not-found%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

            Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

            Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020