2

Running a query to add a list item. When setting columns in a list I set a column named '2138023830'. It is the hash code of a string. This is the code that sets it:

for( var i = 0; i < $scope.optionalQuestions.length; i++ ) {
    console.log("Setting optional question with index " + i);
    if( optionalBodyClicked[i] ) {
        newCourseReviewItem.set_item($scope.optionalQuestions[i].hashCode().toString(), $scope.optionalTextAreaTexts[i]);
    } else {
        newCourseReviewItem.set_item($scope.optionalQuestions[i].hashCode().toString(), "");
    }
}

later on I update and load, and then execute the query:

newCourseReviewItem.update();
context.load(newCourseReviewItem);

context.executeQueryAsync(
    submitCourseReviewSuccess,
    submitCourseReviewFail
);

When I actually run the code, here'e the error I get:

enter image description here

Okay well that column there does exist, I don't know what crack SharePoint is smoking (hint: every kind). Here is proof if you don't believe me:

enter image description here

Btw, the list Course-Reviews is stored at /teams/OBDev/Lists/CourseReviews so the correct URL is being accessed. Thanks in advance!

3

Go in and check the internal name of the column. You can do this by editing the column and looking at the Field parameter in the url. In my case when I created a column with that name the internal name began with _x003, which is, I think, the ascii character for end of text

Generally I think it is best to not start column names with numbers or special characters.

2
  • 1
    Fixed by changing the hash function to return positive integers only and adding a letter at the start of the field names. Spot on thank you. – Isaac C Way Apr 19 '17 at 17:56
  • You'll also want to keep the hash and letter shorter than 32 characters. I think that is the limit on internal name length. – Rothrock Apr 19 '17 at 19:32

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.