Trying solve a custom case where I need to submit the form (AEM 6.4 Adaptive Form) to store the fields in a database and then email the same set of fields as an email. What would be the optimal way to do this using forms?
1. Customize "Form Data Model" Submit type (/libs/fd/afaddon/components/actions/fdm) ?
The question came up was if inheritance is possible for submit types.
So used sling:SuperResourceType="fd/afaddon/components/actions/fdm", but seems that didnt work (the dialog properties are not populated from parent, if the cq:dialog is empty)
So went ahead with copying /libs/fd/afaddon/components/actions/fdm under /apps/<project>/formActions/fdm. I changed the description and submitService on the node property as "Submit using Form Data Model And Email".
This showed up in forms Editor. But the data didnt get saved !!
On trouble shooting the post.POST.jsp found that Map<String, Object> resultMap = submitServiceManager.submit(submitInfo, Boolean.FALSE); was returning NULL.
After much googling found that submitServiceManager looks for the submitService node Property and if it does not match "Submit using Form Data Model", the service is not retuned and it silently dies !!. Not even a single trace !! (-1)
So the qtn is how programmatically initialize the FormSubmitActionManagerService with a service and use it for calling multiple submitServices?
Apart from writing your own implementation for FormAction, one thing more can be explored. Keep the submit to OOTB FDM only and post-submit success invoke a workflow and trigger a mail. You can check the GuideBridge Submit options.