track users after login by id or url ?

please help me '(, i want to track the user after log-in because when I save the data its will saved on the last record on the entity the system will not recognize who enter the system and get the user information 

mvp_badge
MVP
Solution

See if you are getting correct record from your aggregate.

As you are using GetUserWith... aggregate for showing and updating user data, so apply filter like this

User.Id = GetUserId()

Looks like right now you are getting all users and always updating last one (because this is what you get when you reference with current property.

Hi Rawan,

If you wanted to know who entered the data in database then you can create CreatedBy ,CreatedOn , UpdatedBy and UpdatedOn fields in your entity and at the backend on your save action  you can pass the data to CreatedBy=getuserid(), CreatedOn =currdaytetime(), UpdatedBy =getuserid() and UpdatedOn =currdaytetime()

so that you can get the who entered data and when the entry make.

Hope that helps,

Kind Regards,


Hey, Are  you able to solve it or still have an issue?

yes :(, I think I didn't explain what I need well, my application has two types if users teachers and student and for each one, I need to save his info, but the problem is when I save it after registration its work but if it's after login it's will update in the last record on my table the system does not know or track in which user I update. 

In that case pass role id while creating and updating the data

mvp_badge
MVP

Hi Rawan, 

I think your implementation is wrong. As you said after registration when you update user info it is updated in correct record which means you are actually always updating last record. After registration it is correct because this is the latest record in your table.

I am not sure about your implemented logic this is what I noticed in your comment. Better would be to share the oml or save action logic screenshot here for us to see.

this for updated information 

this for login 

I don't know how to track the user on different pages after login 

mvp_badge
MVP

There screenshots are not enough as it doesn't tell me how you are assigning updated values and what object you have assigned in these update actions.

Can you tell me what value are you assigning as input to your Update action? Is it this GetUserWi.... aggregate?

If it is current object of your aggregate's response then may be that aggregate has multiple records and current pointer is at the end to every time you update only last record is updated. 

file limit allowed (4mb) 

 ok you mean I need to use an assignment before the update action? 

but if it was the first time the system saves the info in the database but if I register another user and login for an old account the system just updates  the last record.

i try to use get Id and URL but dose not work 

mvp_badge
MVP
Solution

See if you are getting correct record from your aggregate.

As you are using GetUserWith... aggregate for showing and updating user data, so apply filter like this

User.Id = GetUserId()

Looks like right now you are getting all users and always updating last one (because this is what you get when you reference with current property.

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