# Persistent Dynamic Properties on Component

**URL:** <https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113>\
**Category:** Module Development\
**Tags:** sdk, ignition78\
**Created:** [August 6, 2018, 9:30pm UTC](https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113 "2018-08-06T21:30:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cody.tamaki](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@cody.tamaki](https://forum.inductiveautomation.com/u/cody.tamaki)\
**Post date:** [August 6, 2018, 9:30pm UTC](https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113/1 "2018-08-06T21:30:49Z")

</div>

Hi All,

I have a component that will generate it’s own dynamic properties and I have the intention that users would then bind them to other tags/components to give my component some input. Whenever I set up a page from scratch, everything is fine but whenever I re-load a screen, my component is still creating those dynamic properties and the client/designer throws a bunch of errors. Is there a way to persist dynamic properties on a component?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 6, 2018, 11:36pm UTC](https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113/2 "2018-08-06T23:36:38Z")

</div>

Any dynamic properties you have on a component when the project is saved in the designer will be restored _ **after** _ component creation during window deserialization. If you must dynamically create properties, you should defer it to component startup (I think), and only create the ones that are missing.

---

<div class="post-metadata">

**Author:** ![cody.tamaki](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@cody.tamaki](https://forum.inductiveautomation.com/u/cody.tamaki)\
**Post date:** [August 7, 2018, 3:49pm UTC](https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113/3 "2018-08-07T15:49:51Z")

</div>

Does that mean I’ll need to override the get/setDynamicProps routines to make that object mutable? Or will the following work?

```auto
TreeMap<> dynamicProps = getDynamicProps();
// add/remove missing members...
setDynamicProps(dynamicProps)

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 7, 2018, 9:50pm UTC](https://forum.inductiveautomation.com/t/persistent-dynamic-properties-on-component/19113/4 "2018-08-07T21:50:31Z")

</div>

I don’t think you should be using setDynamicProps(). Like, ever. Just add stuff to the TreeMap from getDynamicProps(), after checking that you aren’t stomping on same-named properties already there.
