# session.props.auth.user.userName

**URL:** <https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [March 19, 2021, 11:24pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706 "2021-03-19T23:24:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 19, 2021, 11:24pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/1 "2021-03-19T23:24:45Z")

</div>

I have a onStartup script on a table, it calls a script that it passes self to, this comes back with NoneType:

caller.session.props.auth.user.userName

After the view loads I have a refresh button that does the same thing but it works fine. Any thoughts?Thx, jake

---

<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:** [March 20, 2021, 1:06am UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/2 "2021-03-20T01:06:06Z")

</div>

Startup is before login or even a solid session ID. You’ll need to pick a different event.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 20, 2021, 1:42am UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/3 "2021-03-20T01:42:02Z")

</div>

What would be an event after the session starts and before the view loads?

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 22, 2021, 7:22pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/4 "2021-03-22T19:22:04Z")

</div>

Anybody else know a better event to do this?Thx, jake

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 23, 2021, 5:27pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/5 "2021-03-23T17:27:34Z")

</div>

I’ve tried using messages but it seems the view and session aren’t ready to roll at the same time. The only thing I need from the session is the username, is there another way to get this?Thx, Jake

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [March 23, 2021, 9:05pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/6 "2021-03-23T21:05:39Z")

</div>

Without your specific requirements it is difficult to make suggestions 🙂 . Why do you need the username on table startup? Is it to load data based on the user logged in?

If this is the case, why not reference the session.props.auth.user.userName in the data binding?

If this is not the case, please post more information, images, etc.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 23, 2021, 9:09pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/7 "2021-03-23T21:09:25Z")

</div>

So after login the user is brought to a view with a table that lists things based on the login. The script fills out the list and uses self to get the session props and 2 controls to fill out the list properly. There’s a refresh button that works fine, would like the table filled out when the user logs in so they don’t have to hit refresh. Many people now think the scada is broken, 7.8.5 could do this so they are coming from that and think 8.1.x is broken.  
The list can’t build itself because it’s far too variable.Thx, jake

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [March 23, 2021, 9:13pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/8 "2021-03-23T21:13:18Z")

</div>

@codersmurf, where is the data for the list coming from, is it from a DB?

Can you post screenshots of the script?

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 23, 2021, 9:18pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/9 "2021-03-23T21:18:37Z")

</div>

def Load(caller):  
units\_tag = caller.session.props.auth.user.userName  
hide\_customer = False;  
if units\_tag == ‘Demo’:  
hide\_customer = True

```
units = system.tag.readBlocking(['[default]' + units_tag])[0].value.split(',')

unitList = caller.getSibling("Units")
filter = caller.getSibling("Filter")
ds = []

for unit in units:
	filterv = system.tag.readBlocking(['[default]' + unit + '/Territory'])[0].value
	if filter.props.value != 'All' and filter.props.value != filterv:
		continue
	statusv = system.tag.readBlocking(['[default]' + unit + '/Status'])[0]
	color = GetColor(statusv.value, statusv.quality.isGood(), unit)
	status = ""
	company = ""
	location = ""
	volts = ""
	d = system.tag.readBlocking(['[default]' + unit + '.enabled'])[0].value
	if d == False:
		comploc = system.tag.readBlocking(['[default]Disabled-' + unit])[0].value.split(',')
		status = "NA"
		if hide_customer == True:
			company = "NA"
			location = "NA"
		else:
			company = comploc[0]
			location = comploc[1]
		volts = "NA"
	else:
		if hide_customer == True:
			company = 'NA'
			location = 'NA'
		else:
			company = system.tag.readBlocking(['[default]' + unit + '/Company'])[0].value
			location = system.tag.readBlocking(['[default]' + unit + '/Location'])[0].value
		if statusv and statusv.quality.isGood() == True:
			statusi = system.tag.readBlocking(['[default]' + unit + '/StatusIndicator'])[0]
			status = Faults.GetLabel(statusi.value, statusv.value)
		else:
			status = "NA"
		compv = system.tag.readBlocking(['[default]' + unit + '/CompMainsVoltage'])[0]
		if compv and compv.quality.isGood() == True:
			volts = "%4.1f" % compv.value
		else:
			volts = "NA"
	data = {"Unit": {"style": {"classes": color}, "value": unit}
			,"Company": {"style": {"classes": color}, "value": company}
			,"Status": {"style": {"classes": color}, "value": status}
			,"Location": {"style": {"classes": color}, "value": location}
			,"CVDC": {"style": {"classes": color}, "value": volts}}
	ds.append(data)

unitList.props.data = ds
```

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [March 23, 2021, 9:36pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/10 "2021-03-23T21:36:23Z")

</div>

@codersmurf, could this be moved to a binding on props.data that uses a property binding linked to the session.props.auth.userName and a script transform with the above script?

The advantage of this is that the binding ‘should’ evaluate after the table loads. Also, if the userName changes it will refresh the binding. The refersh button can also simply be updated to use [pathToTable].refreshBinding(‘props.data’).

Apologies if I’m heading down the wrong path or interpreted anything incorrectly.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 23, 2021, 9:39pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/11 "2021-03-23T21:39:04Z")

</div>

From what I’ve read and been told it’s far too complicated for bindings.

---

<div class="post-metadata">

**Author:** ![codersmurf](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@codersmurf](https://forum.inductiveautomation.com/u/codersmurf)\
**Post date:** [March 25, 2021, 10:03pm UTC](https://forum.inductiveautomation.com/t/session-props-auth-user-username/44706/12 "2021-03-25T22:03:57Z")

</div>

Anybody else have any thoughts? I’ve updated to 8.1.3 with the same issues.Thx, jake
