AEM Forms: Customizing "Submit using Form Data Model"



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) ?

2. Invoke a workflow from the form submission?

As first trial tried to customize /libs/fd/afaddon/components/actions/fdm (taking Adobe Experience Manager Help | Writing custom Submit action for adaptive forms as the guiding article).

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?

Here in my case the FDM and then the Email ?

(seems there is no way to set the service)



Accepted Solutions (1)

Accepted Solutions (1)



I had this issue.

Solved by creating own FormSubmitActionService service implementation


submitActionServiceManager.getSubmitService("myFormSubmitActionService ").submit(submitInfo);

hope this helps

Answers (1)

Answers (1)




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[1].

Or, Invoke a write service of FDM (Adobe Experience Manager Help | API to invoke form data model service from adaptive forms ) and then call the OOTB email submit. I haven't tried this but worth a try.  

[1]Adaptive Forms Class: GuideBridge