Create a ‘capture history’ field for comments

Home Forums Modern DFFS Create a ‘capture history’ field for comments

Viewing 3 reply threads
  • Author
    Posts
    • #36661
      Jorah Lavin
      Participant

        Greetings

        I’m using Modern DFFS v1.0.13.0 (most recent approved version in my company).

        I have a business case where the version history in a multiline text field is not sufficient. The client needs to be able to export the entire history of various text fields, and SP OOB doesn’t allow that. I figured out how to write the text from the field to a history field, but when there’s a second edit later it overwrites the first comment. I want to concatenate the new comment, along with a date stamp and listing of who wrote the comment, into the history field.

        I’m almost certain there was a built-in way to do this in the on-premises version of DFFS, and I’m hoping it’s here and I just haven’t found it yet.

        Thanks for any guidance.

      • #36662
        Alexander Bautz
        Keymaster

          Hi,
          Yes, there was an option when setting field value in the classic version (using “prepend” or “append” keyword in the set field value section of a rule).

          I haven’t used the same keywords in the modern version so the method is a bit different.

          Use a rule triggering on “Before save of the form” > Set field value and use the “Add dynamic content” control to add something like this following:

          [[fieldValue:AppendCustom]]
          [[timestamp:{"date":"today","offsetDays":0,"format":"MM/dd/yy"}]] [[currentuser:displayName]]
          [[fieldValue:Comment]]
          

          This will append the value from the field “Comment” to the existing text in the “AppendCustom” field.

          You can also use custom js like this:

          function dffs_PreSaveAction(){
            var currValue = dffs_beforeProperties.AppendCustom !== null ? dffs_beforeProperties.AppendCustom + "\n\n" : "";
            var newValue = new Date().toDateString() + " " + _spPageContextInfo.userDisplayName + "\n" + getFieldValue("Comment")
            setFieldValue("AppendCustom", currValue + newValue);
            return true;
          }
          

          Alexander

        • #36736
          Jorah Lavin
          Participant

            Thank you, Alexander! I was able to get this running, and it’s very nice. This is what I ended up with in my Set Field Value:

            =============================================
            Edited on [[timestamp:{“date”:”today”,”offsetDays”:0,”format”:”MM/dd/yy at HH:mm”}]] by [[currentuser:displayName]]
            Comment: [[fieldValue:Comment]]
            -=-
            [[fieldValue:History]]
            =============================================
            After seeing how this worked in DFFS I was able to replicate it in Power Automate as well, which will be handy for folks in the company who don’t have access to DFFS.

          • #36740
            Alexander Bautz
            Keymaster

              Thanks for the feedback – and thanks for sharing the soution.

              Alexander

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.