This shows you the differences between two versions of the page.

Link to this comparison view

best practices - user activity [2016/09/14 14:19]
best practices - user activity [2016/09/14 14:19] (current)
Line 1: Line 1:
 +** How can I record users' activity in an app, such as tracking what which users viewed/​edited which records? **
 +<WRAP round info 60%>
 +Also known as: history, audit trail, ​
 +Let's say you want to track when a document record was viewed.
 +You will need to create two tables. Document and Activity. ​
 +Create a Document table. For this example, it will just have the existing short text name field. ​
 +Create a table called Activity with the following fields:
 +  * Activity Type - Static selection field, single seelction - Come up with some basic types for your activity type such as Document Viewed, Document Deleted, Email Sent, etc. 
 +  * Created By - Database-driven (dynamic) selection field based on the User table. This field will store the current user at the time the activity record is created. ​
 +  * Created On - Date/Time Field - This will store the time the record was created. ​
 +  * Document - Database-drive (dynamic) selection field based on the Documents table. This field will create a relationship between the Activity record being created and the Document that was viewed. (The Documents table would have been created previously.)
 +Create actions:
 +Go to the View page for your Document table.
 +Bring up the actions for the "View Document"​ link. 
 +Add an action to create a new Activity record. ​
 +Save the Activity Type as Document Viewed
 +Save the Created By as the current user. 
 +Save the Document as the item the page is about. ​
 +On your Activity table, you will now see a new record every time someone clicks the View Document link.
best practices - user activity.txt ยท Last modified: 2016/09/14 14:19 (external edit)
Copyright WorkXpress, 2020