Afform Submissions: record submitted data
Overview
When Afforms are submitted they can be logged resulting in an AfformSubmission entity. This records the result of the submission but not the data submitted. Often when investigating problems with any forms it is useful to know what data was entered.
Example use-case
- From the Form Builder page, click 'New Submission Form'
- Use the default 'Individual' entity - add a title, check 'Log submissions', add a 'Page' eg civicrm/test, Save
- Go to the URL civicrm/test, enter 'Test99' for last name and first name, Submit
- Go back to the Form Builder page, note there is 1 submission logged. Click on '1 Submission'. Note the id
- In Api Explorer 4, use
AfformSubmission
get
with awhere id =
and the id from the previous line.
Current behaviour
Example result:
[
'id' => 11,
'contact_id' => 203,
'afform_name' => 'afformTest',
'data' => [
'Individual1' => [
[
'id' => 205,
],
],
],
'submission_date' => '2022-07-20 08:49:30',
],
Proposed behaviour
As above but including the entered data:
'submitted' => [
'Individual1' => [
[
'first_name' => 'Test99',
'middle_name' => '',
'last_name' => 'Test99',
],
],
]
Comments
This would also facilitate taking actions based on logged results.