Using v. 8.x-5.1 of webform, and adding email handlers to /admin/structure/webform/manage/MY_WEBFORM/handlers, I have access to tokens for webform and webform submissions.

After upgrading to 8.x-5.2, the tokens are no longer available and the emails being sent out look like this:

Submitted on Mon, 04/01/2019 - 20:21

Submitted by: Anonymous

Submitted values are:

Any help would be greatly appreciated!

Comments

alberto56 created an issue. See original summary.

alberto56’s picture

Title: After upgrade from 5.1 to 5.2, Webform tokens groups no longer show up » After upgrade from 5.1 to 5.2, Webform tokens groups no longer show up on email handlers page
Issue summary: View changes
alberto56’s picture

Priority: Normal » Major

I have also experienced this on an unrelated site, so I'll move to major, as this might cause strife for users who are informed of submissions via email and do not necessarily have access to the backend. (In my case hundreds of emails go out daily to different users and there is no workaround for them to have access to the data as they don't have accounts on the site).

Meanwhile, using 5.1 (composer require 'drupal/webform:5.1') works fine.

jrockowitz’s picture

Priority: Major » Normal

This regression was caused by #3040616: EmailWebformHandler with tokens types extensible I am pretty sure the browser token dialog is just missing the webform/submission tokens while the email handler is still correctly replacing the tokens.

jrockowitz’s picture

Priority: Normal » Critical

I miss read the issue and this should be marked critical until we can make that token replacement is working as expected.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new2.26 KB
new4.74 KB

The attached patch fixes the browse token dialog. I can't replicate the generate email with missing token replacements.

Attached is my attempt to replicate the missing token replacement issue.

Can you please provide an example that replicates the missing token replacement issue?

jrockowitz’s picture

I did a full review of the patch from #3040616: EmailWebformHandler with tokens types extensible and I am not seeing how the token replacement could have broken. Generally, the Webform module has good test coverage for keys things like token replacements but minimal or no coverage for minor UX features like the token browse dialog.

alberto56’s picture

Thanks for looking into this @jrockowitz, I had a hard time reproducing this on a new environment and I finally found a way to consistently reproduce this and it has to do with multi-page forms:

(1) Using webform 8.x-5.1, create a multistep form which sends an email whose custom body contains: [webform_submission:values]
(2) Fill in the form manually (don't use the webform "test" mode) and confirm all values are sent in the email
(3) Update to webform 8.x-5.2, drush updb -y && drush cr
(4) Fill in the form manually (don't use the webform "test" mode) and confirm you see only the values from the first page of the form

In my tests, the webform "test" mode resulted in everything working as expected in 5.1 and 5.2, however manually entering the data resulted in it being sent only in 5.1.

The reason I was getting no data in the submissions is because in my case I the fields in the front page of my webform were not required.

The submissions not being sent might be a separate issue from the tokens not appearing.

alberto56’s picture

@jrockowitz I am attempting now to reproduce this on a new Drupal site and will report back with my findings shortly

jrockowitz’s picture

StatusFileSize
new5.03 KB

I am not able to replicate the issue described in #8 using the attached webform.

alberto56’s picture

Priority: Critical » Normal

Thanks again for your time @jrockowitz; I am not able to reproduce it after a few hours of trying: my broken webform acts fine when I duplicate it on my existing setup; and it acts fine on a new environment; I will write this off as a fluke, and will open a new ticket with more detailed steps to reproduce if it occurs again. I will thus suggest setting this back to normal and dealing only with the token selector GUI here, if that's OK with you.

jrockowitz’s picture

@alberto56 How about you export the broken and duplication form and let's do 'Diff' to see what is missing or broken?

If you are uncomfortable doing a diff you can upload both webform config files here.

alberto56’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new9.17 KB

@jrockowitz so both forms are in fact identical (both the yml and the exported config) which is odd. I am including it here for the sake of completeness, however it is almost certain to me now that this is unrelated to the problem addressed by this patch, and probably related to some alter hook or something, somewhere in the code. Because I had the same form on two different sites, and because the issue started occurring at the same time as the missing token from the browse token window, I assumed they were related, but, turns out they are not. So thanks again!

Also, setting your patch to 'reviewed and tested', as it works fine for me.

jrockowitz’s picture

I think we need to do a comparison of the entire webform's config and not just its elements.

alberto56’s picture

@jrockowitz, so as a last ditch effort to figure this out, I exported the entire webform config, I then deleted my database, reinstalled Drupal and set the site UUID to the same as the config, then reimported everything, and I can no longer reproduce the issue at all, even with the original webform which was causing issues. So, this should probably be marked database corruption of some type. Thanks again for your help with this, as always!

jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

  • jrockowitz committed f679849 on 8.x-5.x
    Issue #3045021 by jrockowitz, alberto56: After upgrade from 5.1 to 5.2,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.