Alteryx designer Discussions

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

Get App User name at Run TIme

Highlighted
Asteroid

Hi OmerM,

 

Thank you very much for this example.  I have it working on my private server.  Do you happen to know why the __cloud:UserId textbox would not pull the current User Id if it is in a macro?  I was trying to put your workflow in a macro so that I didn't have to duplicate this effort every time I needed the current user.

 

Thanks,


Jon

Atom

That's a great solution but I just have one question,

I would like to use this but wouldn't want to use the default mongoDB user set up by default. can I add read-only users to the database somehow?

Highlighted
Comet

Those interested in this thread may also be interested in voting up this idea: https://community.alteryx.com/t5/Alteryx-Product-Ideas/Make-Server-User-a-System-Constant/idi-p/9501... to make this easier.

 

Highlighted
Meteoroid

i'm using a private gallery. how do we get the credentials of mongodb used by the gallery to use in the mongodb input to get the user information?

Highlighted
Pulsar
Pulsar

If you need to get the user's Mongo ID at runtime, you can find a solution (workaround really) here:
https://community.alteryx.com/t5/Alteryx-Connect-Gallery/Get-App-User-name-at-Run-TIme/m-p/775#M20

 

It employes the "__cloud:UserId" (double underscore) constant, but you'll need a hidden text box tool to capture it.

Highlighted
Meteoroid

this is what i'm looking for.

 

i would like to know who is running my app when someone in the firm runs the app in the private gallery. i tried the following approach

 

1. configured the text box according to your post. (hide the api, and __cloud:UserId)

2. when i add the mongo input tool, i do not know which credentials to use. I.e. server name , user password of the gallery etc.

 

could you help me, where i'm  going wrong ?

Highlighted
Pulsar
Pulsar

All depends on what you want to do with the app run information (the user, the date/time, if your app has user entered parameters what parameters did they pick, etc.).

 

For me, when a user runs one of my apps, at the end of their run, I like to have their Mongo user ID and date/time of completion dumped into a YXDB.  I can then use those YXDBs to join to the Mongo Inputs in another separate module so I can get any info I want for the app.

 

The cloud ID thing will simply capture their Mongo ID at runtime.  What you do with it from there, is up to you.

Highlighted
Meteoroid

i'm trying to use this to get the credentials. mongoDB Input connector connects to the users collection of the gallery. could you please tell me how to configure the this tool such that it connects to the private gallery?

Highlighted
Pulsar
Pulsar

Everything depends on what you want to do.  If you simply want to run a module that will tell you who has run what app, and all their other user information, then you don't need the cloud ID thing.  I use it simply because I want to keep separate a simple YXDB with each user-run that tells me who ran it, and when.

 

So if user A ran app B, then I want a YXDB that tells me that.  I put the cloud ID in the app B, and then have a separate module read in that YXDB to tell me that user A ran app B.

 

If you're looking for a report like this:

2018-05-11 12_24_45-Clipboard.jpg

 

Then you don't really need to do that.  You can get this sort of report by using multiple mongo inputs.  Within the Services databases there's AS_Results, AS_Queues, and AS_Applications.  Everything to produce the above report is there.

 

But again, it all depends on what you want to do.

Highlighted
Pulsar
Pulsar

Also, there are several canned reports in the public gallery I think if you don't need as much detail as I have above.

Labels