0

when i try to add listitem to custom list by CSOM there is a problem in getting the name of fields field name in the list is"Pieces Unaccompanied Hold Baggage(Rush)" ,but when i try to add item ,error fires that the field does not exist

code:

oListItem.set_item('Pieces Unaccompanied Hold Baggage(Rush)', "value");

1

You got an extra ")" in your code. It should be this way:

oListItem.set_item('Pieces Unaccompanied Hold Baggage(Rush)', "value");

But, in oListItem.set_item() method, the first parameter shoult be the INTERNAL NAME of the field. You will find the internal name in the URL when you open the field (column) settings. So it should be

oListItem.set_item('InternalName', value)
  • i removed it but the main error that if field name is more than 2 words it does not work – Shams Eldeen Nov 6 '18 at 13:23
  • You should use the internal name in the set_item function. I have mentioned it in the answer. – harshal gite Nov 6 '18 at 13:25
  • What you are using I suppose is the Display name (name which appears on forms and list views). – harshal gite Nov 6 '18 at 13:26
  • thanks it works but the internal name it only appeared in the URL of the page not on the form – Shams Eldeen Nov 6 '18 at 13:34
  • Yes. A SharePoint field has 3 names - Internal Name (unique name over the site which appears in URL), Display Name (Unique Name within List which appears on forms and list views), static name (somewhat similar to internal). You can read this for a better understanding - blogs.perficient.com/2009/04/30/… – harshal gite Nov 6 '18 at 13:38

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.