Home › Forums › Modern DFFS › Create a ‘capture history’ field for comments
- This topic has 3 replies, 2 voices, and was last updated 1 year, 7 months ago by Alexander Bautz.
-
AuthorPosts
-
-
April 7, 2023 at 15:02 #36661
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.
-
April 8, 2023 at 09:44 #36662
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
-
May 1, 2023 at 13:06 #36736
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.Attachments:
-
May 1, 2023 at 14:17 #36740
Thanks for the feedback – and thanks for sharing the soution.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.