Experience User Data via Virtual Button to Workflow

Trying to send userTags into a workflow with data entered by an Experience User using a user input block.

  1. My experience user logs in and via a GET request to /gateways accesses the dashboard where he will submit some information via a user input block. According to the render log this is successful and the information I want to send to the workflow (along with the user input data) is available at {{experience.user.userTags.companyName}} when the user logs in to the page:


  2. Context is setup in the top right corner or the dashboard:

  3. The user input block is setup to send JSON via the virtual button which should submit the information for gatewaySerialNumber, gatewayMACAddress and the companyName of the logged in user:

4.It looks like the two items entered into the text fields work getting back but the companyName does not make it through in the correct format of the value of the companyName for this user which is “machinesaverinc” but instead it shows as “[object Object]”:
image

  1. Note on messing with that object variable if I add .value to the JSON payload after the ctx.companyName I get the default value of the dashboard which is “someothercompany” instead of the variable based on the logged in user which should be “machinesaverinc”.
    image

Any ideas where I’m messing this up?

Hi Leo!

Device Tags are set up a little bit differently when using context variables, as you are able to access both the key and the value (companyName=someothercompany). Thus, you would be able to perform both ctx.companyName.key and ctx.companyName.value and get back companyName and someothercompany, respectively. If I have a device tag context variable named deviceTag, and have it set to color=white, I can then access both color and white, like so:


More information on using Device Tags within context can be found here.

Let me know how else I can help!
Julia

Julia,
Yes no problem accessing the key or the value from the [object Object] by adding .key or .value to the end of ctx.companyName.
The issue is that I always get the default value regardless of which Experience User is logged in to my application.
My hope is that the key will remain the same for all users (as I force each user to enter a companyName upon sign up when they join our application and put their answer as the value of the tag) but to get the value to update based on the logged in user.

Thanks,
Leo

Hi Leo,

My apologies, I misread your question! :smile:

I took a peek at our Multi-Tenant Example to see how context was being set per logged in user. If I am interpreting your screenshots correctly, it looks as though your companyName context variable is not being set to machinesaverinc, and is sending you the default value of someothercompany. This can be remedied by setting up the Dashboard Context for your experience page that has this dashboard. In the Multi-Tenant Example, the context is being set by grabbing the group of the logged in user (group={{experience.user.experienceGroups.[0].name}}):

All you will need to do is grab the user tag path and set it up in Dashboard Context, and you should be able to send that value back through the workflow!

Let me know if this works,
Julia