0

I am using REST API in C# to create new record in the Custom Object.

But it throw an error. I verified that field exists on the object.

//Error Message //[{ "message":"Unable to create/update fields: Name. //Please check the security settings of this field and verify that it is read/write for your profile or permission set.", //"errorCode":"INVALID_FIELD_FOR_INSERT_UPDATE","fields":["Name"]}]

This is how my Custom App policy looks like

enter image description here

Here is the code

var json = JsonConvert.SerializeObject(RowData);

        HttpContent contentCreate = new StringContent(json, Encoding.UTF8, "application/json");
        string uri = $"{serviceURL}{ApiEndpoint}sobjects/{Object.SalesObjectName}";

        HttpRequestMessage requestCreate = new HttpRequestMessage(HttpMethod.Post, uri);
        requestCreate.Headers.Add("Authorization", "Bearer " + authToken);
        requestCreate.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        requestCreate.Content = contentCreate;

        HttpResponseMessage response = client.SendAsync(requestCreate).Result;
        var result = response.Content.ReadAsStringAsync().Result;

1 Answer 1

0

If the data type of the Name field on the object is Auto-Number, then you can't use the field in an insert or update operation.

1
  • yes, that field turned out to be AutoNumber
    – NSS
    Mar 17, 2021 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.