How can I add a new attribute (last login date) to the resource object.
This field is stored in the cmn_sec_users table.
You can refer to the following Knowledge-base document , to track the login date by resource, from an OOTB perspective.
Where in Clarity can I find the last login date by resource?
The resource object cannot be enabled for process , which could run a GEL script. You could add an attribute on the resource object, however the resource object cannot be associated in a custom process, which could have further actions on it.
Hope the above helps.
I am aware of the out of the box portlet that can show the last login date (User Count by License Type). However our management requested to have the last login date at the resource list portlet. I want a way to add this field (last login) to the Resource List portlet.
You can not add it to the Resource List screen without creating a new attribute in the object and populating it through some (potentially unsupported) mechanism when the user logs in.
However you could easily build a simple custom portlet with simple NSQL that shows this information though. (It would not be the "Resource List" but an additional screen in the application)
From OOTB perspective, having a last login date associated at Resource object's list view , will not be feasible.
There is an Idea raised presently for the same, refer to the link below:
Resource Administration - Ability to configure / export section / power filters
Hope this helps.
Just wondering again...
When a user logs in a sessions is created and a record in the sessions table.
The session is cleared when user logs out properly or by the cleaning job.
You could create a custom object to store the data from sessions and populate that with a process just before the job runs.with just one record for each user for a day. If that misses too many of the properly closed sessions the process could be run more frequently say hourly during peak hours.
Then you could have another process to check if there were any new records to the custom object during the past day and if there were you could xog in the date to a custom field of the resource object.in
Eventually you could display that in the standard resources list view..supported to me.
Far fetched, but appears supported to me
Yeah well you could populate a custom resource attribute from the value on cmn_sec_users via a process and run the process "continually" in order to have up-to-date information on the resource record, but that (and your proposal) I think just are very heavy-handed (and potentially system-hogging) complex things to solve what is a pretty simple requirement... so the temptation for anyone technical building such a thing would be "lets just add a quick database trigger to cmn_sec_users (or cmn_sessions) and forget about all that fiddly process/XOG stuff" which would be the unsupported bit!
(which is really why I just said "potentially" earlier )
The "right" answer really is to challenge the stated requirement - i.e. solve the requirement (to see when a resource last logged in) rather than implement a "solutionised"-requirement ("put the login date on the resource list")
Database trigger is not advisable and it will affect system performance. Better to create a on-demand process and update the user last login information in resource object for only mismatched records.
In your query, you need to compare last login information in cmn_sec_users and ODF_CA_RESOURCE table, if both information is not same, then you need to update those records instead of updating last login information for all users.
You can consider only active users in your query block.