Learn more about the Alteryx Maveryx Universe recently announced at Inspire 2023!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Get App User name at Run TIme

s_pichaipillai
12 - Quasar
Hi There,
I am building Apps using Alteryx and i need to audit the data. so here is the requirement
App User can feed the file thru Interface and run the workflow thru Apps
the question is , how do i capture the USER  who is executing the Apps and insert the user name into Audit table or the data at runtime ?
Thanks
saravanan
54 REPLIES 54
kane_glendenning
10 - Fireball
Hi Saravanan,

I thought that I would drop a comment on this as there has been no reponse for a couple of days. I would also like to know how to do this.

For an app running outside of the gallery, I use a Run Command tool, calling the Global Environment variable for %Username% (Thanks to Mike Bryan at Inspire for this). However, I don't think that will work in the gallery environment both from a security standpoint and even if it did run, it may call the wrong environment.

When I look at the Gallery Usage Report app, it calls the user from the MongoDB instance (Collection: Users) and parses the field:"_id" to get a list of Users and to get Session data, it reads the Collection: Sessions and uses the field UserId. The MongoDB instance can be reached using the MongoDB connector tools. The data has to be getting saved at some point, and so I would think that it could be grabbed from the workflow, just not sure where.

I hope this helps a little but, I will be very keen to hear if someone has more information than that (as there must be a better solution).

Kane
benjamin_carley
6 - Meteoroid

Hello!

Would you be able to tell us how this app will be run? From a server or downloaded to each users computer? In the quite limited case of each user downloading the app to their personal computer, would you be able to use the work flow directory variable? 

For example my WorkflowDirectory would be c:/Users/Ben.Carley/AppData.... so if I wanted to recover the text Ben.Carley I could use regex.

The expression I would use would be "Users\(.*)\AppData" and then I could use this as I see fit. 

Hope this helps but if not, give us a little bit more info and I'm sure we can do something!

Ben

s_pichaipillai
12 - Quasar
Thanks Kane i will try this

@Ben, User will run the apps from server , perhaps from Gallery 
Do you think we can grab the User who runs the apps at run time ?

Thanks for responding ...really appriciate it 

Saravanan
OmerM
Alteryx Alumni (Retired)

Hi Saravanan,

 

Take a look at the attached app - it uses an API call to extract the UserID of the active user.

 

You will need to update the MongoDB connector credentials to match those in your environment.

 

Credit to @NickJ for building this workflow.

 

Thanks,

Omer

mbarone
16 - Nebula
16 - Nebula

Here is what I do.


If you think this will suit your needs, I can give you details and configurations.

 

On my apps (which run on our private server), I always have one of the outputs, which the user does not know about, spit the data they are extracting to a YXDB in a folder on the Server.  Only I have access to the Server, not my users, so no problem there.


That output looks like this:

"20151229140959_503bac188031af11f8f8e479_APPNAME.yxdb" (you can see the first string is the datetime, the second is the user, and the third is the appname).  It will create the yxdb for each run.

 

I have a separate module that pulls the following user information:

GalleryUsersBrowse.jpg

 

At that point, it's just a simple join to line up your users with the report and/or data that they extracted.

 

 

Hi ,

 

My requirements are the same as displayed. I have to validate the user id and then allow him to input values in alteryx gallery. Can you share how you are extracting the results. 

 

Appreciate your support.

 

Thanks,

Sathish Jayaraman

 

mbarone
16 - Nebula
16 - Nebula

Hi Sathish,

Here is what I do in order to store the app results . . . start a new stream from the last tool that has all the data records, with a block until done.  Instantly calc ONE date/time (so all records have only one date/time associated with them, append that date/time to each record, blend in the User ID with the Date/Time in the format I showed in my prior reply above, and output to wherever you want.  I use a secured drive on my Server that only I have acces to (meaning the user doesn't even know I'm collecting everything they run . . . my users do not have the ability to see the actual YXWZ . . . only the interface that runs in the Gallery).  You have to use a text box configured as "hide" with an annotation of "__cloud:UserId (double underscore).

 

Here's my final steps that do what I just described:

AppOutput.jpg

 

The output in the YXDB you create then shows like this:

   YXDB Name:AppOutput_2.jpg

 

YXDB Results:  AppOutput_3.jpg

 

Hope that helps!

SandeepChayanam
7 - Meteor

Hi all,

One of the usecases i'm currently working on is see how the row level security (show only appropriate rows to users based on the user login) can be implemented in alteryx. Looks like many of you have come accross this usecase and tried to do it in alteryx.

 

 

Any of you know why the "__cloud:UserId" option in the text box tool doesn't return a value when an app is run from a gallery?

 

I'm noticing it returns the userId sometimes but when i use the same logic in a different app, it returns an empty string. Any ideas?

 

Regards,

Sandeep.

bsharbo
11 - Bolide

I want to second Sandeep's comment.  If you have an analytic App on a gallery and it is run, using the __Cloud:UserID for me always returns a null string.  

 

Is there a setting or something that needs to be changed to make the __Cloud:UserID function work?

 

 

 

Labels