I'm using Drupal 8 together with the Webform module.
Is there a way to transfer the value of a field in a specific content type to a webform?

This is the situation:
There's a content type called 'Vacature' where you create the specific content (vacancies). When adding a new vacancy I provide a field called 'vacaturecode' and a dropdown where you select the application webform that will be used to apply for the vacancy.

The application webform collects all the data of the applicant including two uploads (CV and motivation letter).
For these two upload fields I use the property 'File name pattern' to rename the original uploaded document to 00_lastname_CV_vacaturecode.pdf upon submission.

Therefore I use a string of tokens in the 'File name pattern' property: [webform_submission:serial]_[webform_submission:values:lastname]_CV_[webform_submission:node:field_vacaturecode:value]

This works, only I don't get to add the value of the field 'vacaturecode' that is submitted when creating the content. Instead the syntax is added as value.
I already tried various combinations of the syntax (e.g. [webform_submission:source-entity:entity:field_vacaturecode:value]) but I don't get it right.

Is there a way to address this value from within the webform?

Thanks for you help!

1 Answer 1


this sounds like a case for hook_webform_submission_presave. You can also see the available hooks here: http://api.drupalhelp.net/api/webform/webform_hooks.php/group/webform_hooks/6.3

You'll need to add the hook implementation to your theme or module file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.