Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Pulling the user info into the app from who ran it on the gallery

The_Dev_Kev_Env
9 - Comet

HI All,

 

I am hoping this is a silly question and there if a variable/constant I can drop into the workflow for this, but I want to bring the username of who is running the app into the workflow to dictate how the workflow runs. Does anyone know what that variable might be?

 

Workarounds I'd like to steer clear from:

- Handling the authentication through manually maintained authentication tables that I am comparing parameters I give the user (user, pw) . Clunky and multiple areas of authentication.

- Changing configuration of gallery to prompt for credentials before running app. I believe this would also require us granting privileges on the server to run apps for each user we would do this for. And I still think I'd have to use some run command to get that user info.

 

Any answers here are appreciated!

 

Best,

Kevin

25 REPLIES 25
mbarone
16 - Nebula
16 - Nebula

Hi @Jithendra ,

Did you check out YXMD1 that I posted earlier?  Does that give you what you're looking for?

seven
12 - Quasar

@The_Dev_Kev_Env 

There is a solution that can be used in any workflow, not just an App. One can use a function to determine the username executing the workflow on the Gallery. The workflow must be using Run As credentials in the Gallery and this works in version 2019.4.8.22007.

 

GetEnvironmentVariable('USERNAME')

 

 

I like using this in a Generate Rows tool to bring it out of the ether instead of bringing in a Text Input tool with a dummy value first. I have attached a workflow to demonstrate this.

 

Side note: We have some workflows in production that can run in different modes on an ad hoc basis. Since these workflows take hours, the user who kicks them off usually does so in a fire and forget fashion. Hours later, the inevitable "I ran this in the wrong mode" sets in. I used the functionality above to find the username, query AD to get the user email, and within minutes send an email that the wrong mode was running.

 

blyons
11 - Bolide

The solution by @seven does not work for us at all, because it requires the Gallery to run apps as the user logged in, which ours doesn't, and can't do. Our Gallery services run under a special service account, which is what is returned by this function. Users do not have the necessary permissions to do most of the functions we have in apps.

 

IMHO, stick with the solution posted by @mbarone, which also includes other essentials, like email address, FirstName, LastName, etc., until a better built-in solution is created.

anuninan07
7 - Meteor

Hi @The_Dev_Kev_Env 

 

Can you share the link if its still available 

anuninan07
7 - Meteor

@mbarone do we need admin access to execute MongoDB input tool?

mbarone
16 - Nebula
16 - Nebula

@anuninan07 - no.  But you do need the credentials for your server access (server name, controller token) so you might have to get that from your Admin.