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 Answer 1

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)
5
  • i removed it but the main error that if field name is more than 2 words it does not work Commented Nov 6, 2018 at 13:23
  • You should use the internal name in the set_item function. I have mentioned it in the answer. Commented Nov 6, 2018 at 13:25
  • What you are using I suppose is the Display name (name which appears on forms and list views). Commented Nov 6, 2018 at 13:26
  • thanks it works but the internal name it only appeared in the URL of the page not on the form Commented Nov 6, 2018 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/… Commented Nov 6, 2018 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.