4

I have created a custom content type based on the built-in "Event" content type. which have two columns "Start Time" and "End Time" of type Date and Time. now i can add a new item using the quick edit grid , for example i can specify the start time to be 15/03/YYYY 20:00 and end time to be 15/03/YYYY 21:00 , and the item will be saved correctly.

but the problem i am facing if i try editing the item using the quick edit grid , and i modify the end time to be 15/03/YYYY 22:00 instead of 21:00 , where i will get the following error:-

Invalid data has been used to update the list item. The field you are trying to update may be read only.

enter image description here

but if i edit the item using the edit form , i will not receive any error ? so can anyone advice on this please? why i am unable to edit the end time using the quick edit grid ?? keeping in mind that i can i modify the title, agenda and other fields using the quick edit without any problem ??

  • Check format of time you are using. – vikk Mar 15 '16 at 17:26
  • @vikk If there is a problem with the format then adding a new item will not work,, but my case the problem will happen when i try to edit existing item using quick edit grid ONLY... while editing the item using the edit form will work fine... i mean if there is a problem with the time/date format then i will not be able to create items or edit them using edit forms.. is this correct? – john Gu Mar 21 '16 at 16:32
  • Please tell if you found a solution – Oleg Feb 4 at 4:48
2

I am putting my answer here in case people find this question by googling the error message that in the title of this SO question. This answer might help others who come across this strange error message.

I had the same error when I was updating a calendar event with server side code.

My code first added a new empty list item. This new list item has default values for the start date and end date. A few lines later, the list item fields are updated one by one and then a list item update is called. In my case, the start date was not being updated by my code and remained the default value. The end date got updated by my code and the end date was earlier in time than the default start date. When the list item update was fired, this error would be displayed in my exception logs.

Once I corrected this and adjusted the start date to always fall before the end date and then call update, the error went away.

Perhaps by using the quick edit form and updating just the end date first, it is actually making the end date fall before the start date. The normal edit form will not allow you to do this via JavaScript validation?, which is why you don't get this error there.

1

After banging my head against the wall and Google searching, Taterhead's advice above put me on the right track. Export the list to Excel and make you time changes there. Copy both the start and end times (at least, or all fields if you like) in you Excel file and paste them all at once in the Quick Edit view of your list. This worked for me.

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.