Identify username, to create dynamic path

Hi,

I’m looking to create a dynamic path, that incorporates the MacOs username. I’m having trouble figuring out the best way to access what the username of the person opening a specific workflow so that I can dynamic push it to the file location, with a variable.

Any ideas how I could achieve this, it would allow a workflow to be run across several users, and the moment it is sandboxed to the user who created the workflow (as it links based on their username).

Thanks,
Geoff

Hi,

you could use a Java Snippet with a call to System.getProperty("user.home"); which gets the path to the home directory, e.g. /Users/qqilihq on macOS.

Does this help?

2 Likes

I think you could use the extract nodes

4 Likes

Wow thanks for the quick reply, I’m not too rehearsed at using the java snippet, can you screenshot how I’d write that into the Java Snippet node?

Probably @mlauber71’s solution is the simpler option, but for the records, here’s an example workflow on how to configure a Java Snippet which gives you the home directory path as a flow variable:

Best regards,
Philipp

4 Likes

Thanks Philipp, much appreciated!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.