If an application is using the apex authentication scheme, how do you handle change in user names if folks get married or divorced. The reason I ask the question is that all of apex uses v('app_user'), which is the user_name. If I have transactions done by this user and then their name changes, which means so does their id, how do I get all of their transactions, before and after the name change. Traditionally I would expect to use user_id, not sure if this feature is still available. I can always create a custom auth scheme, but that is a lot of additional work. Any ideas?
Appreciate your help and time Jari, below is my game plan, unless someone has a better idea,
I plan on doing the following to use user_id for auditing of transaction records:
1. Get the user_id to use in the tables audit trail fields
user_id := apex_util.get_user_id(v('app_user'));
user_id := apex_util.get_current_user_id;
2. If a user changes their name then use
My 2 cents.
Generally you would never want to use the username as your primary/foreign key anywhere - a user id would be your best bet.
But considering your username is your "identity", typically identities don't change. Obviously your IT dept doesn't have a policy, but where I work identities (we use Active Directory) are considering authoritative and do not change. So if you get married, it doesn't change. If you get divorced, it doesn't change. You can obviously change the last name attribute of a person, but their identity shouldn't change based on life events.