Allow webform_submission_log to store submission data

Created on 2 September 2022, over 2 years ago
Updated 5 December 2023, about 1 year ago

Problem/Motivation

webform_submission_log is able to log information about a submission post-save. However, webform does not provide the form submission data, which limits what can be done with the log information. One can only know who did what when on which submission, but cannot really know what actually changed on the submission.

Steps to reproduce

1. Enable webform and webform_submission_log.
2. Create a form and enable logging.
3. Create submissions on that form.
4. View /admin/structure/webform/submissions/log
5. Look at webform_submission_log table in the DB.

On Step 4, you can see that the submissions created in Step 3 are logged.
On Step 5, the data column of those rows are empty.

Proposed resolution

- Allow \Drupal\webform\WebformSubmissionStorage::doPostSave() to pass the saved form's data into the log context so that loggers like webform_submission_log can operate on that data. In webform_submission_log's case, it will store it in the data column of the webform_submission_log table.
- Goal of this ticket is to get the data in there. Rendering the log lines, especially in a pretty way, is out of scope.

Remaining tasks

- Patch
- Review
- Merge

User interface changes

None

API changes

None

Data model changes

Form data is serialized into the data column of webform_submission_log upon submission creation or update.

✨ Feature request
Status

Closed: won't fix

Version

6.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fskreuz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    This feature should be handled via custom code or dedicated contrib module.

  • πŸ‡¨πŸ‡³China davyin ShangHai

    Looks like there is no hooks or eventDispatcher to change the data write into the table: webform_submission_log.

    So what's the best practise? using hook_entity_CRUD?

    In my scenario, I want to log the info like this:

    {FIELD1} change FROM {A} to {B}
    {FIELD2} change FROM {1} to {2}

    Any advice will be appreciated

Production build 0.71.5 2024