How can we deactivate users who didnt logged in for more than 15 days.

0
can any one help me with the code  for the below The users needs to be deactivated if he havent't   logged for   more than 15 days. and He needs to be activated once he logins again. please suggest me some steps . Thanks.
asked
2 answers
0

The user object has a LastLogin with a date and time. So in a microflow create a date time variable with the current date time and use the addDays function to substract 15 days. Then use that value to retrieve all the user accounts that has a LastLogin date before it.

Regards,

Ronald

 

answered
0

read the documentation about scheduled events:

https://docs.mendix.com/refguide/scheduled-events

 

with a scheduled event you can kick-off a microflow that creates a variable with the date 15 days ago:

addDays([%CurrentDateTime%], -15)

 

after that you can retrieve all users from the data base with the xPath constrained constraint: 

[LastLogin < $CreatedDate]

after that you can loop trough all users and change the artibute ‘Active’ to false 

 

answered