# Dataset setFieldValue then no longer works

**URL:** <https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [July 21, 2018, 12:55pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266 "2018-07-21T12:55:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pptgames](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pptgames/32/1306_2.png) [@pptgames](https://forum.wixstudio.com/u/pptgames)\
**Post date:** [July 21, 2018, 12:55pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266/1 "2018-07-21T12:55:07Z")

</div>

Hi,  
So I have this code on my WebSite in lots of pages and it always worked. But a few days ago I have noticed some issues and when I looked at the console I saw an error saying “Uncaught (in promise) TypeError: Cannot read property ‘then’ of undefined”.

When I remove the “.then(() =\> {” it works again. But why doesn’t it work now with the “then”?

---

<div class="post-metadata">

**Author:** ![stcroppe](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stcroppe/32/4559_2.png) [@stcroppe](https://forum.wixstudio.com/u/stcroppe)\
**Post date:** [July 21, 2018, 3:44pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266/2 "2018-07-21T15:44:38Z")

</div>

According to the wix docs…

> **[wix-dataset - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/wix-dataset)**
>
> A dataset connects page elements to a set of items in a data collection.

setFieldValue doesn’t return a promise.

This function changes the current item in the data set BUT doesn’t commit the change until you save() it.  
It’s the save() that returns a Promise that you can perform a .then() on.

Perhaps you removed a save() call???

---

<div class="post-metadata">

**Author:** ![pptgames](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pptgames/32/1306_2.png) [@pptgames](https://forum.wixstudio.com/u/pptgames)\
**Post date:** [July 21, 2018, 4:01pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266/3 "2018-07-21T16:01:47Z")

</div>

No I haven’t changed the code for a long time.

---

<div class="post-metadata">

**Author:** ![stcroppe](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/stcroppe/32/4559_2.png) [@stcroppe](https://forum.wixstudio.com/u/stcroppe)\
**Post date:** [July 22, 2018, 12:01pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266/4 "2018-07-22T12:01:30Z")

</div>

OK well the problem is that setFieldValue() doesn’t return a promise which means that you are calling then from an undefined object.

Perhaps wix determined that the save() function was the area that a promise was really needed and changed it at some point?

---

<div class="post-metadata">

**Author:** ![pptgames](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pptgames/32/1306_2.png) [@pptgames](https://forum.wixstudio.com/u/pptgames)\
**Post date:** [July 22, 2018, 12:09pm UTC](https://forum.wixstudio.com/t/dataset-setfieldvalue-then-no-longer-works/7266/5 "2018-07-22T12:09:00Z")

</div>

I just know that I have updated all my code and now it’s working again.
