I used the Webform Entity Handler to create a handler to update a value in a node that should be triggered when the webform is saved as draft, submitted, or updated. The handler is working on submit and update, but not when the draft is saved.
Thanks in advance for your help.
Here is the YAML for the handler:
update_reviewer_2:
id: webform_entity_handler
handler_id: update_reviewer_2
label: 'Update Reviewer 2'
notes: ''
status: false
conditions: { }
weight: -49
settings:
operation: 'input:source_id'
entity_type_id: 'node:resource'
entity_values:
field_reviewer_2:
target_id: 'input:reviewer_2'
entity_revision: false
states:
- draft
- completed
- updated
Here is the full YAML code for the webform:
langcode: en
status: open
dependencies:
module:
- webform_entity_handler
weight: 0
open: null
close: null
uid: 3
template: false
archive: false
id: review_webform
title: 'Review webform'
description: ''
category: ''
elements: |-
source_id:
'#type': webform_computed_token
'#title': 'Source id'
'#template': '[webform_submission:node:nid]'
'#store': true
'#ajax': true
link_to_resource:
'#type': webform_computed_twig
'#title': 'Link to resource'
'#title_display': none
'#display_on': form
'#template': 'Return to resource'
reviewer_1:
'#type': webform_entity_select
'#title': 'Reviewer 1'
'#empty_option': 'Select reviewer 1'
'#target_type': user
'#selection_handler': 'default:user'
'#selection_settings':
include_anonymous: false
filter:
type: role
role:
administrator: administrator
sort:
field: name
direction: ASC
reviewer_2:
'#type': webform_entity_select
'#title': 'Reviewer 2'
'#empty_option': 'Select reviewer 2'
'#target_type': user
'#selection_handler': 'default:user'
'#selection_settings':
include_anonymous: true
filter:
type: role
role:
administrator: administrator
sort:
field: name
direction: ASC
short_description:
'#type': textfield
'#title': 'Short description'
are_these_true:
'#type': webform_likert
'#title': 'Are these true?'
'#questions':
'Has content?': 'Has content?'
'In the right format?': 'In the right format?'
'About the right topic?': 'About the right topic?'
'Information is up-to-date': 'Information is up-to-date'
'#answers':
'Yes': 'Yes'
'No': 'No'
'Not sure': 'Not sure'
'#na_answer': true
review_result:
'#type': webform_term_select
'#title': 'Review result'
'#empty_option': 'Select final result'
'#vocabulary': review_result
'#breadcrumb_delimiter': ''
final_decision:
'#type': textarea
'#title': 'Final Decision'
'#autocomplete': 'off'
'#access_create_roles':
- authenticated
resource:
'#type': number
'#title': resource
'#prepopulate': true
css: ''
javascript: ''
settings:
ajax: false
ajax_scroll_top: form
ajax_progress_type: ''
ajax_effect: ''
ajax_speed: null
page: true
page_submit_path: ''
page_confirm_path: ''
page_theme_name: ''
form_title: source_entity
form_submit_once: false
form_open_message: ''
form_close_message: ''
form_exception_message: ''
form_previous_submissions: true
form_confidential: false
form_confidential_message: ''
form_disable_remote_addr: false
form_convert_anonymous: false
form_prepopulate: false
form_prepopulate_source_entity: false
form_prepopulate_source_entity_required: false
form_prepopulate_source_entity_type: node_type
form_unsaved: false
form_disable_back: false
form_submit_back: false
form_disable_autocomplete: false
form_novalidate: false
form_disable_inline_errors: false
form_required: false
form_autofocus: false
form_details_toggle: false
form_reset: false
form_access_denied: default
form_access_denied_title: ''
form_access_denied_message: ''
form_access_denied_attributes: { }
form_file_limit: ''
form_attributes: { }
form_method: ''
form_action: ''
share: false
share_node: false
share_theme_name: ''
share_title: true
share_page_body_attributes: { }
submission_label: ''
submission_exception_message: ''
submission_locked_message: ''
submission_log: false
submission_excluded_elements: { }
submission_exclude_empty: false
submission_exclude_empty_checkbox: false
submission_views: { }
submission_views_replace: { }
submission_user_columns:
- serial
- created
- completed
- element__final_decision
- element__reviewer_1
- element__reviewer_2
- element__review_result
submission_user_duplicate: false
submission_access_denied: default
submission_access_denied_title: ''
submission_access_denied_message: ''
submission_access_denied_attributes: { }
previous_submission_message: ''
previous_submissions_message: ''
autofill: false
autofill_message: ''
autofill_excluded_elements: { }
wizard_progress_bar: true
wizard_progress_pages: false
wizard_progress_percentage: false
wizard_progress_link: false
wizard_progress_states: false
wizard_start_label: ''
wizard_preview_link: false
wizard_confirmation: true
wizard_confirmation_label: ''
wizard_auto_forward: true
wizard_auto_forward_hide_next_button: false
wizard_keyboard: true
wizard_track: ''
wizard_prev_button_label: ''
wizard_next_button_label: ''
wizard_toggle: true
wizard_toggle_show_label: ''
wizard_toggle_hide_label: ''
preview: 0
preview_label: ''
preview_title: ''
preview_message: ''
preview_attributes: { }
preview_excluded_elements: { }
preview_exclude_empty: true
preview_exclude_empty_checkbox: false
draft: authenticated
draft_multiple: false
draft_auto_save: true
draft_saved_message: 'Review saved, but not submitted.'
draft_loaded_message: 'Review in progress. To complete the review, click submit below. Save as draft to save your work without submitting the review.'
draft_pending_single_message: ''
draft_pending_multiple_message: ''
confirmation_type: message
confirmation_url: ''
confirmation_title: ''
confirmation_message: 'Review submitted. If you need to edit a submitted review, navigate to the results tab and select the review to edit, or edit from review list at the bottom of this page. '
confirmation_attributes: { }
confirmation_back: true
confirmation_back_label: ''
confirmation_back_attributes: { }
confirmation_exclude_query: false
confirmation_exclude_token: false
confirmation_update: false
limit_total: null
limit_total_interval: null
limit_total_message: ''
limit_total_unique: false
limit_user: null
limit_user_interval: null
limit_user_message: ''
limit_user_unique: false
entity_limit_total: null
entity_limit_total_interval: null
entity_limit_user: null
entity_limit_user_interval: null
purge: none
purge_days: null
results_disabled: false
results_disabled_ignore: false
results_customize: false
token_view: false
token_update: false
token_delete: false
serial_disabled: false
access:
create:
roles:
- authenticated
users: { }
permissions: { }
group_roles: { }
view_any:
roles:
- authenticated
users: { }
permissions: { }
group_roles: { }
update_any:
roles:
- authenticated
users: { }
permissions: { }
group_roles: { }
delete_any:
roles: { }
users: { }
permissions: { }
group_roles: { }
purge_any:
roles: { }
users: { }
permissions: { }
group_roles: { }
view_own:
roles:
- authenticated
users: { }
permissions: { }
group_roles: { }
update_own:
roles:
- authenticated
users: { }
permissions: { }
group_roles: { }
delete_own:
roles: { }
users: { }
permissions: { }
group_roles: { }
administer:
roles: { }
users: { }
permissions: { }
test:
roles: { }
users: { }
permissions: { }
group_roles: { }
configuration:
roles: { }
users: { }
permissions: { }
administer_submissions:
group_roles: { }
handlers:
update_source_last_review_date:
id: webform_entity_handler
handler_id: update_source_last_review_date
label: '[current-date:html_date]Update source last review date'
notes: ''
status: false
conditions: { }
weight: -46
settings:
operation: 'input:source_id'
entity_type_id: 'node:resource'
entity_values:
field_last_reviewed:
value: '[current-date:html_date]'
entity_revision: false
states:
- completed
last_review_result:
id: webform_entity_handler
handler_id: last_review_result
label: 'Last review result'
notes: ''
status: false
conditions: { }
weight: -48
settings:
operation: 'input:source_id'
entity_type_id: 'node:resource'
entity_values:
field_last_review_result:
target_id: 'input:review_result'
entity_revision: false
states:
- draft
- completed
- updated
update_reviewer_2:
id: webform_entity_handler
handler_id: update_reviewer_2
label: 'Update Reviewer 2'
notes: ''
status: false
conditions: { }
weight: -49
settings:
operation: 'input:source_id'
entity_type_id: 'node:resource'
entity_values:
field_reviewer_2:
target_id: 'input:reviewer_2'
entity_revision: false
states:
- draft
- completed
- updated
update_reviewer_1_on_draft:
id: webform_entity_handler
handler_id: update_reviewer_1_on_draft
label: 'Update Reviewer 1 on draft'
notes: ''
status: true
conditions: { }
weight: -50
settings:
operation: 'input:source_id'
entity_type_id: 'node:resource'
entity_values:
field_last_review_result:
target_id: 'input:review_result'
field_reviewer_2:
target_id: 'input:reviewer_2'
field_review_1:
target_id: 'input:reviewer_1'
entity_revision: false
states:
- draft
- completed
- updated
variants: { }
Comments
Comment #2
facine commentedupdate_reviewer_2:
id: webform_entity_handler
handler_id: update_reviewer_2
label: 'Update Reviewer 2'
notes: ''
status: false
Your handler is disabled.
Comment #3
beagaliana commentedClosing this issue, please feel free to reopen it if needed. Thanks!