Adding a record but not getting displayed

Hi Everyone

When the add user button is clicked, the data is getting updated in the database yet it is not getting displayed on the screen. Also need to rest the id when the user is deleted. The image below shows id as 110 after 17 

Example below -

Logic of save button -


TestModuleV2_.oml

Solution

In the table you are using the GetUserRole aggregate - which only returns the users that have the roles the current EspaceId - instead of GetUsers.

Solution

So, to see what is happening, print in an expression the 

GetEntryEspaceId()

This way you will be able to see which space id you are in. after that go to the roles entity and see which space id is the role that you associated the User with.

That way you will see that for the user that you created, with the filter that you are doing you will not get all the Users.

And yes, Anderson is correct too when he says that you are not using the aggregate Users without any filters.

Hi Saif,

I think you need to add below condition as you are first creating the User without role and then you are assigning the role

Role.EspaceId  =  GetEntryEspaceId() or Role.EspaceId =  NullIdentifier()

Best Regards

Devendra

Why do you need this?

If you remove it, you will see the data that dismissing, is something related to the roles. You are not using the GetUsers, that is returning every user for any role! If you click find usages you will see.

What is really happening is that you are filtering by the space where you are, and the roles were created in another space I think

It was needed to display the user's role before. He already has another Aggregate to get the users data but it's beeing used only in the TotalCount / Pagination.

using the get e  space filter since it was showing roles present in the other applications aswell. 

and the roles aggregate to show according to the roles assigned. 

what @anderson is saying is also correct.

Could you please suggest changes

Solution

So, to see what is happening, print in an expression the 

GetEntryEspaceId()

This way you will be able to see which space id you are in. after that go to the roles entity and see which space id is the role that you associated the User with.

That way you will see that for the user that you created, with the filter that you are doing you will not get all the Users.

And yes, Anderson is correct too when he says that you are not using the aggregate Users without any filters.

Saif, as I mentioned in my other comment, you already do have a GetUsers aggregate which is not beeing used. Just set the expression values to this aggregate. I see you have 2 tables in the page, are they both the same or one to check the user's role and other to see all users in the database? 


Or you could just set some role for the users while creating them (it looks like the new users dont have any of the previously created roles).

Solution

In the table you are using the GetUserRole aggregate - which only returns the users that have the roles the current EspaceId - instead of GetUsers.

I would suggest to use the User_Effective_Role (System) Entity when fetching/checking the roles of a specific user in a query

Hi Saif,

I think you need to add below condition as you are first creating the User without role and then you are assigning the role

Role.EspaceId  =  GetEntryEspaceId() or Role.EspaceId =  NullIdentifier()

Best Regards

Devendra

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.