I have created a custom module for a custom Webform handler. The custom handler submits to an external SOAP api. There are various response options that are received back from the SOAP api that currently I am printing to screen (for testing purposes). But when using this module in production, I obviously want these responses to be displayed at the top of the confirmation page.

Is there some way to populate a token (possibly the Webform Handler Response token?), which I can then use to print the information on my confirmation page?


1 Answer 1


Your two options are…

OPTION 1: Add the SOAP API's response value as a hidden element's value using something like

$webform_submission->setElementData('response_value', $response->value);

OPTION 1: Store the response in $_SESSION and use


to alter the confirmation message or page.

  • Thanks jrockowitz. I've tried Option 1 but I am getting a Duplicate entry error. I think it's because I am trying that within the preSave function. Do I need to alter the code to use with preSave? Aug 1, 2019 at 17:21
  • Don't call $webform_submission->resave(); if you are setting the element data via ::preSave()
    – jrockowitz
    Aug 2, 2019 at 9:25

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.