1

I am pass data like below. where Company name is Multi lookup Field.

{"Address":"","CompanyName":[{"ID":2,"Title":"InfoEngg"}],"Email":"kapil@gmail.com","Title":"Kapil","Mobileno":"9898989898","Password":"Sp@12345","EmpRole":"Level 1"}

Why this error throw?? how can i solve it?

  • Make sure you are passing value for all required column in REST API data(JSON) – Bharat Khunti Jan 22 '18 at 15:33
1

Try changing your CompanyName field to:

"CompanyNameId": {
    "__metadata": {
        "type": "Collection(Edm.Int32)"
    },
    "results": [ 2 ] // Array of the IDs of your selected items
}

Since per your comment your data format is set, why not just transform it before sending your update?

var data = {"Address":"","CompanyName":[{"ID":2,"Title":"InfoEngg"}],"Email":"kapil@gmail.com","Title":"Kapil","Mobileno":"9898989898","Password":"Sp@12345","EmpRole":"Level 1"};

var updateData = {
  Address: data.Address,
  CompanyNameId: {
    "__metadata": {
      "type": "Collection(Edm.Int32)"
    },
    "results": $.map(data.CompanyName, function(c) { return c.ID; })
  },
  Email: data.Email,
  Title: data.Title,
  Mobileno: data.Mobileno,
  Password: data.Password,
  EmpRole: data.EmpRole
};
| improve this answer | |
  • i know this way but i have pojo class it contains all data for that lookup – Vishal Thakkar Jan 23 '18 at 5:52
  • Well, you asked why you're getting an error, and that's why. The service is expecting CompanyNameId and it's not there. :) – Chris Romp Jan 23 '18 at 5:55

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.