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

Question

Question

Passing table field variables from a Form into an Email

asked on March 14, 2016

Hello!

I have a Time-Off Request Form that I am wanting to pass dates from the form into an email body.  The form has a table that allows associates to enter up to 10 dates into an email.  I have found that if I use the field token for only when one date only is submitted into the email it works fine, but when two or more dates are entered I don't seem to be able to present the dates into the email in the same order as how associate enter the form.  Here are some examples of what the form currently allows and what shows up in the email.  Ideally, we would want to it show in this format on email:

 

Dates and Hours

1/1/2016-1/2/2016

2/1/2016-2/2/2016

 

Any help on this would be very helpful!

Thanks,

Justin

Form_Date_Time.JPG
DateTimeEmail.JPG
2 0

Replies

replied on March 14, 2016

Hi Justin,

When you put a multi-value Forms field into the email activity, the values are listed with a semicolon between each of them. Therefore, using the format: {/dataset/Table/From} - {/dataset/Table/To}

will result in: (From1; From2; From3) - (To1; To2; To3)

I would suggest using Workflow to format the values and send the email, which would look something like this:

 

Here is the "Assign Field Values 2" configuration:

Here is the Email configuration, with the Token Editor being used on the "Dates" token:

And the resulting email:

Let me know if this works for you!

4 0
replied on March 14, 2016

Alex's suggestion is a good one. The other thing you could do is to build the string using Javascript and store it on a hidden field on your form. Then on your email activity, you reference the value from the hidden field variable. The code for this would look something like:

$(document).ready(function(){
  $('.DateTable.cf-table-block').on('click blur',function(){
    var str = '';
    $('.DateTable.cf-table-block tr').each(function(ind){
      if (str != '') str = str+'\n';
      if (ind != 0) str = str+$(this).find('.FromDate input').val()+' - '+$(this).find('.ToDate input').val();
    });
    $('.HiddenField textarea').val(str);
  });
});

Here, I am using the following CSS Classes:

  • DateTable - The main table
  • FromDate - The From column in the table
  • ToDate - The To column in the table
  • HiddenField - A multiline text field, hidden, which contains the date ranges
3 0
replied on March 17, 2016

Thank you!

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

Sign in to reply to this post.