On a button click just call a microflow in which add a create object activity in which u can add current user attribute and set it value as current user and in form u can also show it.
you can create two attribute in one entity and for first just add : create by which is already saved in entity option and then second as changed by .
you can get both option in entity itself you just have to check it.
I think you should work out the step by step yourself, as you will learn more that way. Also, without knowing your domain model its hard to be exact.
But here are some hints -
$currentUser does have an attribute of name , but that is ‘username’ and not the user’s actual name e,g, John Smith.
$currentUser points at System,User which is protected from view by other users, instead you should reference Account ( Adminsitration Module ) because you can adjust security to make its attributes visible,
To retrieve the Account in a microflow you can use xpath [id = $currentUser]
A dataview added to your form can have a datasource of type microflow , which returns an object of type Account.
The user viewing the form is not always going to be the user that changed it.
You can set the property of your form entity to ‘Store changed by’ that will make the link to the System.User for you.
hope that helps.,
Enjoy your Mendix journey.