You are viewing limited content. For full access, please sign in.

Question

Question

Show comment from both previous users

asked on September 29, 2017

I am creating a form for time off requests. When the form is first submitted it goes to HR for approval and then if they approve it goes to the employees supervisor to approve. If both approve the employee is sent an email that the time off is approved. I would like the email that is sent to the employee to have comments entered by both HR and the Supervisor. The supervisor comment is easy, I can just assign {/dataset/_fs_comment} to the email, but I am unable to figure out how to get the HR's comments onto the email. I have tried to create a hidden field that is then populated during the HR Step ID by doing the following:

 

$(document).ready(
  
     function () (


    $('#q12').addClass('hidden');

    if($('input[name="stepid"]').val() =="11") {
      $('#q12').val("{/dataset/_fs_comment}");
    }

});

 

But, there is either something wrong with the syntax, or it cant be done this way. Either way, The field does not populate on the email to the employee.

1 0

Replies

replied on September 29, 2017 Show version history

Hi Dan,

Looks like you're trying to use a LF variable in your JavaScript which won't work. Try this:

$(document).ready( function() {
  $('#q12').addClass('hidden');
  $('#comments').on('change', function () {
    $('#q12 input').val($('#comments').val());
  })
});

 

0 0
replied on September 29, 2017

Tri,

 

I tried what you suggested, but the same thing occurs. Nothing shows up for the comment on the email. 

 

Thank you,

Dan

0 0
replied on September 29, 2017 Show version history

Temporarily remove this line:

$('#q12').addClass('hidden');

and check to make sure that when HR fills out the comments section, field 12 is updated with those comments. Also make sure that the email uses the variable for field 12.

0 0
replied on September 29, 2017

I did this and the comment that HR leaves is not making it into Field 12.

0 0
replied on September 29, 2017

Note that I'm assuming that the comments and field 12 are on the same form HR sees.

0 0
replied on September 29, 2017

Yes, that is correct. The hidden field 12 is on the same form as the comment that HR leaves. 

0 0
replied on September 29, 2017 Show version history

What type of field is field 12? Mine is single-line. If yours is multi-line, try:

$(document).ready( function() {
  $('#comments').on('change', function () {
    $('#q12 textarea').val($('#comments').val());
  })
});

 

0 0
replied on September 29, 2017

It is a multi-line field. I tried what you suggested, but the field is still not populating. 

0 0
replied on September 29, 2017 Show version history

Dan,

Could I ask that you provide me a bit more context? The code works, but it would be helpful if you could copy and paste everything in your JavaScript and perhaps some screenshots of the form. Right-clicking and inspecting your comments field would also be helpful.

0 0
replied on September 29, 2017

Sure, Here is everything that I have for Javascript:

This is just a test form so it only has minimal fields on it. Attached are screenshots of the form itself with the comment box for the employee and the Hidden Field 12 box for the HR Comment, and a screenshot of how the email that gets sent back to the employee is configured.

Form.PNG
Email_Config.PNG
Form.PNG (49.84 KB)
Email_Config.PNG (30.67 KB)
0 0
replied on September 29, 2017 Show version history

Hi Dan, 

Thank you for that. So a few things:

- Line 11 needs to be removed

- I thought you were referring to the Laserfiche Forms comments that get appended to the end of approval user task forms. Didn't realize you made a multi-line field called "Comment". The variable {/dataset/Comment} would be sufficient for the email, and you can just omit the JavaScript/hidden field entirely.

- If this is a new test form, then your hidden field isn't necessarily "q12". You need to grab the id for these fields from the CSS and JavaScript tab. For example, the first field you create for a new form is "q1", which I'm guessing is the id for your "Comment" field.

So with all that being said, I'll take a step back and make a form that mirrors yours, with "Comment" being q1 and "HR Comment" being q2 and the one to be hidden, and get this JavaScript working. Again, this would just be for your reference because you could just use the variable for the Comment field.

I would fill HR Comment with Comment's content using the following: 

$(document).ready(function (){ // When the document readies
  $('#q1 textarea').on('change', function() { // When Comment field changes 
    $('#q2 textarea').val($('#q1 textarea').val()) // Insert what's in Comment Field into HR Comment Field
  })
});

Beyond making sure that your IDs are mapped correctly and that your JS syntax is correct, that should be all you need.

0 0
replied on September 29, 2017

The id of 12 is correct, I looked it up. I am referring to the Laserfiche Forms comments that get appended to the end of approval user task forms. The first comment on the form is to test the employee comment. The second comment field (HR_Comment) I created to try and "capture" the Comment HR leaves on the form (hence the javascript) so that I can add it to the email. Does this make sense? 

0 0
replied on February 7, 2018

Tri,

What would the code look like to append what already exists in the HR Comment with what is in Comment?  So  "HR Comment" + "Comment"?

 

Thanks,

Alon

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.