How to audit / track field level data changes to Records, require comments, and display changes?

Here's what I'd like to do:

1. Track changes to one specific date field within a Record 
2. Require a comment whenever the date field is updated via an existing Related Action
3. Display the tracked changes and comments inside the Record

To provide some context, the record in question has multiple sites associated with it, each with a date (future/scheduled) for monitoring. I'd like to be able to know/see each time this date is updated and why (comment), although it can be updated in two places: via the Update Sites related action, OR inside of a process (Once monitored on or before the scheduled date, User Input Task requires a new date to be set before process completes and then updates the record). 

I'm not sure how to first, require the comment when editing just this one field inside the record, and second, taking this field change and comment and displaying them somewhere. Thanks for any suggestions! 

 

  Discussion posts and replies are publicly visible

  • OR: Instead of providing a comment field, I'd like to offer a Drop Down selection of reasons for the change and then track these choices same as if it were a custom comment. This may be easier to track metrics on why the dates get edited over time. Thanks!
  • 0
    Certified Lead Developer
    I am not sure I follow.
    You are updating via a related action or inside process? Does the "inside process" have any user interaction to force the selection of the reason for update?

    Generally I create history tables in my database to capture the changes. I capture the data from users and process and write to DS. Then I can run query entities to get the info and display in paging grid.
  • Christine - thanks for the feedback.

    If the date is being updated during the other process (not the related action), then yes, the User Input Task requires them to input a new date. In this case it's not important to ask for a comment/reason since it's understood based on the process, but when updating via the related action I would like to record why it's being updated and take that change and reason into some RO interface.

    With the Related Action, this allows you to Update a section of the Record, but that section has multiple fields and I only care about 1 - the date field. How would I create a table to capture changes to just this one field?
  • +1
    Certified Lead Developer
    in reply to Sarah K.
    I would create a history table (historyID (pk), fieldname, newValue, comment, cratedate, created by). Create a cdt to match and put in datastore.
    In your process, called by related action, add comment field to form and save to comment in new pv of type the new cdt. add a script task to then populate other fields (minis id) from other cdt that has new date and process details like initiator and date with now(). Then write to ds to persist data.
    Hope that makes sense.
  • +1
    Certified Lead Developer

    1. To track changes that's made to a specific field, you can just write these changes to a history log table after the form is submitted.

    2. You can do some logic to show a paragraph field that's required for the comments when the date field is changed. Here's a code snippet for an example:

    /*17.2*/

    =a!formLayout(

     contents: {

      with(

       local!orignalDateField:index(rule!TEST_getFormDetails(ri!id).data,"dateField",{}),

       a!columnsLayout(

         columns: {

           a!columnLayout(

             contents: {

               a!sectionLayout(

                 label: "Example",

                 contents: {

                   a!dateField(

                     label: "Date Field",

                     labelPosition: "ABOVE",

                     value:ri!dateField,

                     saveInto: ri!dateField,

                     refreshAfter: "UNFOCUS",

                     validations: {}

                   ),

                   a!paragraphField(

                     label: "Reason for change",

                     labelPosition: "ABOVE",

                     value:ri!comments,

                     saveInto: ri!comments,

                     refreshAfter: "UNFOCUS",

                     showWhen:local!orignalDateField<>ri!dateField

                   )

                 }

               )

             }

           )

         }

       ))

     }

    )

    3. Write a query to pull the data from the history log table.

    Hopefully this can be a starting point for your implementation.

  • I believe you will be using a process model on back of a related action. I would recommend to create a history table and track all the changes you want to log into that history table and then create a view in the record to display all the changes in a grid.
  • hi sarahk09 (sarahk834) ,

    I believe all have given the approach how to manage/track the changes for the date field.  In particular to the comment given by @christineH I would like to add one more addition to the same. Yes , adding a history table will serve your purpose and you can fetch these data and show in a separate dashboard or with in the summary it self. (in respect to records)

    I believe each record will have it's own date field, hence the table structure that is given by CharitineH should be enhance to have a foreign key to the parent record. (historyID (pk), fieldname, newValue, comment, cratedate, created by and parentRecordID).

    I would add a flat relationship rather than having a tight relationship between the parent record and history table, if the change history for the date value is not need to be fetch to memory all the time instead we can fetch it on demand.

    Regards

    Suresh