Timestamped Comments?


Badge +8

Trying to create a comment box to where users can enter comments throughout process milestones and it will time stamp and hard code each time. Can this be done? Thanks in advance!


16 replies

Badge +16

How do you want users accessing this to enter their comments?

do you want them to see the previous comments?

do you want all comments added against one process to be concatenated into one multi line text field?

Badge +8

Hi Cassy

My vision is to have a comment box to where they can enter a comment. Once they hit save, the comment hard codes below the box with a timestamp. The next person (or same person) comes back to that record later and enters a new comment and hits save, and it hard codes above the last hard coded comment. Showing a history of comments with timestamps.

Userlevel 5
Badge +12

Are you using Tasks throughout your process, or do you plan on having them all use the base form (as far as collecting comments)?

Badge +16

OK that makes sense.  do you want them to do it in the form itself or by workflow?

I have created an "Add Comment" workflow on the list which is set to start manually and appears on the item context menu.

It has one variable which is shown on the start page of the workflow and is required.

The workflow does this:

  1. Build String = Current date and time, new line, initiator display name, new line, comments added on start form, new line, item property comments (so new comments are timestamped and added above previous comments).  Stored into variable called vMTextComments
  2. Update Item = set comments field on current item = vMTextComments

Notes.PNG

this will be possible to do in the form also if you wanted it to be done in there.

Badge +8

Hi Cassy

That is EXACTLY what I want!

The caveat of this is, I will not have workflow for another week and I am presenting this to the end user on the same day I get workflow access. So ultimately, I the workflow will work but right now I need it through the form. But I am saving this for sure!

Badge +8

Hi Mike

I have tasks but not for this piece. I plan on having them use the comments to track tasks for each record. Essentially, a manager needs to go in to see each record and see the history before he/she approves from the form. That was the best way I could think of.

Userlevel 5
Badge +12

What version of Sharepoint are you running (2010, 2013, or online?)

Badge +11

Hi Josh,

if you want to do this on your Nintex form, I think you will need some JavaScript:

function addComment() {

    var newComment = NWF$('.commentsBox p').text();

    if(newComment != "") {

        var oldComment = NWF$('.newCommentsBox textarea').text();

        var d = new Date();

        var combComment = oldComment + " " + d.toUTCString() + ": " + newComment;

        NWF$('.newCommentsBox textarea').text(combComment);

    }

}

This code requires:

  • One SharePoint MultiLine column for comment input (css class = commentsBox)
  • One MultiLine Textbox one your form to store all the comments (css class = newCommentsBox)
  • A button which you need to configure to use Javascript as  Button action (clientclick = addComment())

Formatting may need to be improved but should give you something to start with.

Regards

Philipp

Badge +8

This worked great!! Thanks for including the java script. Not my forte! Quick question though...what is the best way to make the history comments box so it is not editable? I thought maybe a "Not Null" condition but I can't figure it out. I know it's probably something super easy but you guys have been so helpful, though I'd give this a shot.Cassy FreemanEmily Billing

Badge +11

Glad to help.

You can set this control to read-only very easily by disabling it in the control settings:

Regards

Philipp

Badge +8

I feel dumb. Thanks!

Badge +7

Philipp,

This is exactly what I am trying to do as well. I know this thread is old, but is there any chance you might be willing to help me further to understand how to get the JavaScript code connected to a button on my form?


Thanks!!

Badge +11

Hi Leah,

if you want to connect your Javascript to a button on your form, all you have to do is open the button settings and change the "Button action" to "JavaScript". Additionally you open up the "Advanced" section of the settings page and enter you javascript function at "Client click":

198862_pastedImage_1.png

This will execute the "myFunction" whenever your button is clicked.

Regards

Philipp

Badge +7

I think I am still missing something....

198892_pastedImage_1.png

198893_pastedImage_2.png

198894_pastedImage_3.png

198895_pastedImage_4.png

Badge +11

Does your function get executed at all? You can insert a simple alert at the beginning of your function to check that.

Can you debug your code?Set a breakpoint at the beginning and see if all your controls are used correctly in your js-code.

Badge +7

Hi Philipp,

I wanted to say thank you for your help with this. I guess my very very limited knowledge of JavaScript and the fact that I am new to Nintex really proved to hinder me in this one. I ended up accomplishing what I needed through a workflow though.

Thank you again for your help!

Reply