# Update preferences field from code

**URL:** <https://community.smartthings.com/t/update-preferences-field-from-code/21219>\
**Category:** Writing SmartApps\
**Created:** [August 27, 2015, 6:45pm UTC](https://community.smartthings.com/t/update-preferences-field-from-code/21219 "2015-08-27T18:45:41Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![zcapr17](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/zcapr17/32/26770_2.png) [@zcapr17](https://community.smartthings.com/u/zcapr17)\
**Post date:** [March 15, 2017, 5:03pm UTC](https://community.smartthings.com/t/update-preferences-field-from-code/21219/5 "2017-03-15T17:03:24Z")

</div>

It appears you can now use:

```
app.updateSetting(inputName, [type: type, value: value]) 
app.updateSetting(inputName, value)
// or for DTHs:
device.updateSetting(inputName, [type: type, value: value]) 
device.updateSetting(inputName, value)

```

However, while the above code seems to be able to change settings with existing non-null values, it does not appear to be able to add values to settings that are currently empty. So half-way there at least…

---

_[View the full topic](https://community.smartthings.com/t/update-preferences-field-from-code/21219)._
