- π¬π§United Kingdom euanfergusson
I dont think you need any custom code to do this
in the "advanced" tab in the email handler select "when submission is updated."
Is there a way to trigger the Emails/Handlers, When webform submission has been updated. I'm using webform_mailchimp
module for the handler. When I'm submitting a new record, handler is working fine and I can receive the data into my Mailchimp account. I have a function to update the submission via code(custom module). This handler doesn't work, when I update an submission. Following is my code to update the webform submission:
$webform = Webform::load('my_form');
$is_open = WebformSubmissionForm::isOpen($webform);
$sid = 2;
if ($is_open === TRUE) {
$webform_submission = WebformSubmission::load($sid);
$webform_submission->setElementData('preferred_date', $form_state->getValue('preferredDate'));
$webform_submission->setElementData('preferred_time', $form_state->getValue('preferredTime'));
$errors = WebformSubmissionForm::validateWebformSubmission($webform_submission);
if (!empty($errors)) {
drupal_set_message(t('Failed! Please contact the administrator.'), 'error');
}
else {
$webform_submission = WebformSubmissionForm::submitWebformSubmission($webform_submission);
drupal_set_message(t("Success! ".$webform_submission->id()), 'status');
}
}
Is there a way to trigger the handler through code(programmatically)?
Thanks,
Closed: works as designed
5.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I dont think you need any custom code to do this
in the "advanced" tab in the email handler select "when submission is updated."