on 12-20-2022 11:22 PM - edited on 12-20-2022 11:22 PM by kcsrestapiuser
The Text Box tool may be more commonly used to build an app where the user would be required to key in some text into the Text Box, but the trick here to name it __cloud:UserId. This is achieved by going into the Annotation tab of the configuration panel, where you can set the __cloud:UserId.image.png
Be mindful of the two underscores and capitalization of the “U” and “I” in __cloud:UserId.
When you set it up this way, the user is not required to manually key an input into the Text Box during run time. Instead, the workflow automatically picks this variable up when the user runs the workflow. Combining this with an Action tool, you would be able to capture and store the value of this variable in your dataset. The variable captured is the Mongo-generated user ID.
An example of how you would achieve this is shown below.image.png
Once this variable is captured, you would then need to query the user table stored on MongoDB to map the user ID to the username, Windows SID or email of the user. This can be done by bringing in a MongoDB input tool that connects directly to the MongoDB of your Server.
The configuration of your MongoDB input tool requires you to specify the Server, User Name and Password (optional), Database and Collection. These details should match your Server System Settings, if you navigate to Options > Advanced Options > System Settings > Persistence.image.png
Under the MongoDB input configuration, the database should be set to AlteryxGallery and the Collection should be users. For the latest schema, you should refer to the Help Documentation. The end configuration should be similar to below.image.png
Once you have connected using the MongoDB input, the user ID field should be parsed with a JSON Parse tool.image.png
Now you simply need a join tool to match the ID captured using the __User:CloudId Text Box with the user ID in the MongoDB user table.
We like this feature - but we want to lock it down inside of an encrypted macro. Currently, it has to be in the parent workflow, but we want to put it within a locked macro for our use case, it is a security concern.
For example, we are wanting to improve the Publish to Tableau Server tool - we do not allow our users to embed passwords in their workflows which is required by the tool. Instead, we would like to use the Cloud:UserID feature to check if someone has access to publish to Tableau, then publish as a shared account. But, if that check is happening in the parent workflow where someone is using the tool, then someone could hardcode a user therefore it isn't secure.
We have brought this up with the Product team through our Customer Success Manager.
Hi - are you able to put the MongoDB portion of the app into a separate macro? I know that doesn't seem ideal to split it up.
@bertal34 - the issue is with the capturing the Cloud User ID - we can't put that inside a macro.
Oh gotcha, I mistook your Tableau pw for that in the MongoDB tool.
Outstanding job adding this to the Knowledge base and explaining so well!!
It may be worth noting that if a user plans to copy & paste the tools into a new workflow, the Textbox interface tool name will change upon pasting. Make sure you go back and rename the tool "__cloud:UserId"