Current RUN user information


How can I get information about current Tago RUN user who triggered the analysis via widget header button? I’m specifically interested in the email address.

I can’t find any examples and don’t fully understand the docs about this topic.

Most widgets will send the user id in the environment variables of your analysis.

The key is _user_id

Running an analysis directly through the Header button will not allow you to get this information. The better method is for you to use the Header button to call another widget, as the wigets does have this functionality.
If needed, you can create a TAB of type “hidden dashboard” and put widgets from header buttons in there.

1 Like

Okay, thank you very much for the explanation.

1 Like

I am trying to do something very similar. Basically when a RUN user adds a device, I want that device to only be available to that user’s dashboard. I plan to do this by using a tag with their email address.

I noticed you mentioned that this gets passed in the environmental variables. Does that mean I have to add _user_id as a key to the analysis env. var? What is the value?

In my analysis script I tried using this but it didn’t work:
{ key: ‘user_access’, value: _user_id },

When a user uses an table form widget through the RUN application, and the widget does have an analysis set to run, it will automatically generate a new environment variable when the analysis run. You don’t need to setup anything in the analysis for it to happen.

For user ID in this case, the environment variable generated is { key: “_user_id”, value: “the user id” }.

I also do think that the Input Form does have a Field type that you can set, where it will send the user id or user email if you want to.

1 Like

I’m still not quite understanding how to pass this to a tag on the newly created device. I’ve been able to create the other tags successfully, but putting the user’s email address in there is giving me trouble.

You said most widgets pass _user_id as an environment var - but how do I key in on this and use it? I’ve added { key: ‘user_access’, value: _user_id.value }, to my code but it didn’t work.

I’ve also added a form field that passes the user’s email address, but I’m still unsure of how to key in on it.

Like, I know I need to get the variables sent by the widget. I’ve tried this:

const _user_id = scope.find(x => x.variable === ‘_user_id’);

Then I add the tag later:
{ key: ‘_user_id’, value: _user_id.value },

I’m missing something…