# Write to Custom Session Properties

**URL:** <https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034>\
**Category:** Ignition Early Access\
**Created:** [October 11, 2019, 8:38pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034 "2019-10-11T20:38:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [October 11, 2019, 8:38pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034/1 "2019-10-11T20:38:24Z")

</div>

How do you write to custom session properties? I’m attempting to write to it from an actionPerformed script on a button, then switch the page afterwards. It’s a very simple `script self.session.custom.client = self.getSibling("Dropdown").props.value` when the next screen i show a label with the new value added to it but it still is retaining the old value. Is there a different way to write to session properties than writing to other types of properties?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 11, 2019, 11:00pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034/2 "2019-10-11T23:00:14Z")

</div>

> [@jramirez3](#):
>
> I’m attempting to write to it from an actionPerformed script on a button, then switch the page afterwards

How are you doing this? If this is a Script Action and then a Navigation Action, there is no guarantee of the execution order. If this is a single script which writes the value and then uses `system.perspective.navigate()` it should be working, and I would need to actually see the script to help you out.

Do you see any errors in the gateway logs when you trigger this ActionPerformed Event?

> [@jramirez3](#):
>
> Is there a different way to write to session properties than writing to other types of properties?

No, (Custom) Session properties behave just like any other property. In newer versions of Perspective/Ignition system-use session properties (most properties in `session.props`) will ignore write attempts.

---

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [October 11, 2019, 11:05pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034/3 "2019-10-11T23:05:12Z")

</div>

It’s a script action, then a navigate action. The script function is just one line of code `self.session.custom.client = self.getSibling("Dropdown").props.value` and the navigate is a page navigation to another view, which is working. This `system.perspective.navigate()` function, where is the documentation on this? I looked in the user manual and i don’t see it. Is this function what i should be using?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 14, 2019, 2:19pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034/4 "2019-10-14T14:19:47Z")

</div>

Here’s the page in the [documentation](https://docs.inductiveautomation.com/display/DOC80/system.perspective.navigate). I would recommend placing both the write and the navigation into a single Script Action. I would also place a logging call after the write but before the navigation just so you can temporarily see that it’s working.

```auto
system.util.getLogger('WRITEVERIFICATION').info('Write completed. New value: {0}'.format(self.session.custom.client))

```

To be clear: Navigation Actions are perfectly valid and work as intended, but when you have multiple Actions which trigger from a single event I don’t believe you get a say in which order they are executed as each is sent to be invoked on a new thread on the Gateway. It’s entirely possible your navigation action is being invoked before the property write, at which point the reference would no longer exist because you’re on a new page (however, I WOULD have expected an error to be displayed in the Gateway logs in this event).

---

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [October 14, 2019, 2:21pm UTC](https://forum.inductiveautomation.com/t/write-to-custom-session-properties/29034/5 "2019-10-14T14:21:53Z")

</div>

Thank you for your help. I guess i was just over looking this function.
