Data grid that shows a specific user name information

1
Dear community, I need your help I have a data grid and I want its records to be shown to clients depending on which client the record was added to, for example: My client's user is Tropical, and an attribute of the entity is client and its value is Tropical, I want Tropical to see only Tropical's data.
asked
18 answers
0

Hi Cristhian,

Could you kindly provide an example of the domain model that you have? that way we can replicate your scenario and help you properly.

Best regards!

answered
0

Hi, Oswaldo, yes, of course:

This is my dom,ain model:

 

Core is my main entity and Cliente is another entity both are related:

 

 

I have a gata grid that shows records in core:

 

 

I’ve created a user called Frutadeli, so, when Frutadeli logs in it must only see Frutadeli’s information in the data grid.

 

How can I solve this?

answered
0

Hi and OK, so if I understood correctly, this is something similar to what you currently have:


In that case, I would suggest that you use a microflow to retrieve the current user information (where Client attribute is assigned to your user entity) outside of the Data Grid:



And then set the data source of the data grid to an XPath similar like this:


That way you can compare the current user’s Client with the Core’s Client (record’s Client).

I hope that solves your question, best regards!

answered
0

Hi and OK, so if I understood correctly, this is something similar to what you currently have:


In that case, I would suggest that you use a microflow to retrieve the current user information (where Client attribute is assigned to the user) outside of the Data Grid:



And then set the data source of the data grid to an XPath similar like this:


That way you can compare the current user’s Client with the Core’s Client (record’s Client).

I hope that solves your question, best regards!

answered
0

Oswaldo, you only forgot to show me the microflow

answered
0

Hi Cristhian, here’s what the microflow looks like:


In my scenario I have this entity for the User, where the generalization is the Administration.Account, this is where I have the Client attribute for the user. In your case in may be different:


I hope that helps!

answered
0

I’m not using Users entity, i’m using this:

 

answered
0

You can use the XPath parameter '[%CurrentUser%]' to access the current user. Example:

 

[Module.Core_Client/Module.Client/Module.Client_User = '[%CurrentUser%]']

 

If “Client” has an Association with the Entity “User” from MX. 


This way you won’t need a dataview to retrieve the currentUser logged in your system.

answered
0

The entity Account uses the generalization of the Entity User, so you can use the following XPath instead.

 

 

[Module.Core_Client/Module.Client/Module.Client_Account = '[%CurrentUser%]']

answered
0

I have this other domain model, here I’m handling the users:

 

answered
0

You can use this XPath:

 

[“CoreModule”.Core_Cliente/”CoreModule”.Cliente/”AccountModule”.Cuenta_Cliente/”AccountModule”.Cuenta  = '[%CurrentUser%]']


Replace “CoreModule” and “AccountModule” with the respective names

answered
0

Ok, you’re using the entity “Cuenta” with the generalization of the entity “Admin.Account” which uses the generalization of the entity “System.User”


So you can use something like this:

 

[CoreModule.Core_Client/CoreModule.Client/AccountModule.Cuenta_Cliente= '[%CurrentUser%]']

answered
0

Ok, you’re using the entity “Cuenta” with the generalization of the entity “Admin.Account” which uses the generalization of the entity “System.User”


So you can use something like this:

 

[CoreModule.Core_Client/CoreModule.Client/AccountModule.Cuenta_Cliente= '[%CurrentUser%]']

answered
0

Raique, is not working :

 

answered
0

is not working:

 

answered
0

[Trust_SEC.Core_Cliente/Trust_SEC.Cliente/TrustApp_Cuenta.Cuenta_Cliente = '[%CurrentUser%]'] 

This might work

answered
0

Raique, look, this is the escenario:

 

This is the first domain model in Trust_SEC module:

 

 

then, I have another domain model in Trust_APP module:

 

 

In this domain model I have the following associations:

 

 

How does the path look like?

 

 

 

 

 

answered
0

And, I’m having this error:

 

answered
0

Hello

To show records in a data grid based on the client associated with each record:

  1. Set up a database field to store client information.
  2. Implement user authentication.
  3. When a user logs in, retrieve their client identity.
  4. Query the database to fetch records matching the client's identity.
  5. Display these filtered records in the data grid.

Check https://forum.mendix.com/p/community/Mulesoft Course

Ensure robust security measures to prevent unauthorized access to other clients' data.

 

Thank you.

answered