Search code examples
databaselistlistviewxpathmendix

XPath error - Trying to get user by name from the database


I'm working on a list of tasks. Users can request to be assigned to a task, and Admin can approve or reject this request.

I almost have it done, but have a problem with the XPath statement in the last 3rd step.


Implementation step-by-step:

  1. I created the tasks entity and associated it with the Administration.Account entity, this way I can assign users to tasks using reference selector.

enter image description here

  1. In each list item, there is a "request assignment" button, when User clicks on it, a microflow takes the name of the current user and saves it to the "requester" string parameter of this item.

  2. When Admin approves a request, a microflow should find the user with the same username as the one stored in the requestor parameter, and associate this list item with this user.

I have a problem with the last 3rd step. As you can see on the screenshot below, I created a microflow and I use Retrieve action to get the user from the database of all registered users. I use this XPath expression, which should help me get only one user, whose name is the same as the name stored in the "requestor" string parameter of the tasks entity:

[Name = $Tasks.Requester] 

But I'm getting an error, and don't understand how to fix it.

enter image description here


Solution

  • Rumata, the right way to access the parameter's/object's attributes is using '/' symbol instead of '.' symbol. When you type / as shown below you will be shown all the attributes if 'Tasks' instead of Administration.Account entity.

    [Name = $Tasks/Requester]

    The '.' symbol is used only when trying to access an enumeration's value in a if statement or exclusive split.

    Example: variable1 = module.enumname.value