# What is the syntax to write to a perspective session custom property?

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [March 21, 2023, 12:55pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369 "2023-03-21T12:55:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 21, 2023, 12:55pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/1 "2023-03-21T12:55:23Z")

</div>

I have a session custom property called WorkstationName. I want to perform a database query to lookup the WorkstationName and then write that value to the custom property.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/1/219d93632f2b91015b71df2975d41a0f57f45559.png)

In the Startup Session Events I have the following code:

```auto
def onStartup(session):
    #self.session.custom.WorkstationName = 'blue'
    session.custom.WorkstationName = 'blue'
```

I have been messing around with different options and while nothing seems to break it also doesn't want to set the custom property either.

Any idea about what syntax to use?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 21, 2023, 12:57pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/2 "2023-03-21T12:57:37Z")

</div>

That looks OK to me. How are you proving that it doesn't work? Have you checked in the client?

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 21, 2023, 12:59pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/3 "2023-03-21T12:59:14Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/e/fee235c9eaa61e487e86d8fb85b57cdb2f92a8cd.png)

In the attached picture I have a label on a view bound to the session property.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 21, 2023, 12:59pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/4 "2023-03-21T12:59:49Z")

</div>

And you check its value in a client, not just in the designer?

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 21, 2023, 1:00pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/5 "2023-03-21T13:00:14Z")

</div>

Yes sir.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 21, 2023, 1:11pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/6 "2023-03-21T13:11:37Z")

</div>

That event only fires when a session first starts. Depending on your settings, a session may persist long after you close or refresh the browser client page. The easiest thing to do is to terminate the session from the web status portal under Perspective Sessions and then relaunch a session/client

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [March 21, 2023, 1:25pm UTC](https://forum.inductiveautomation.com/t/what-is-the-syntax-to-write-to-a-perspective-session-custom-property/71369/7 "2023-03-21T13:25:34Z")

</div>

I see now. After termininating the browser session from the gateway web page the following code executed correctly.

```auto
session.custom.WorkstationName = 'red'
```

Thank you for the help.
