There may be times that minor touch ups to out-of-the-box submission actions for addressing business needs through Sling Resource overlaying may look an appealing option. However, it was found in our environment that applying the concept of Sling Resource Merger in AEM against out-of-the-box submission actions doesn't always work.
Whenoverlayingcomponents in /libs with structure in /apps, it is not necessary to create 1:1 copy of the resource or node, however, in the case of AEM Forms submission action, it's not the case. Doing so will end up a working submission action overlay but the Forms Authoring UIs will no longer present the overlaid actions in the form submission type drop down list.
After investigated, it turns out that the Forms Authoring UIs use following code from /libs/fd/af/components/commons/datasources/propertyprovider/propertyprovider.jsp to present the available submission action type:
and the internal of GuidePropertyProviderUtils.querySubmitOrAutoSaveAction(...) doesn't use any Sling Resource Merger for resource properties but some kind of separated Xpath search in /libs and /apps and separated resource properties read for each /libs and /apps folder. Because of this behavior, the overlay folder must contain the 1:1 copy of all the resource properties of the folder, otherwise the overlaid submission action type will disappear.
For example, following properties for overlaying of /apps/fd/afaddon/components/actions/fdm - FDM (form data model) submission action will cause the submission action type to disappear
because the original properties from /libs/fd/afaddon/components/actions/fdm that should be combined by Sling Resource Merger is not recognized/used by GuidePropertyProviderUtils.querySubmitOrAutoSaveAction(...) internally. 1:1 copy of the node like the following can be used to fix the disappearing issue.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:description="Submit using Form Data Model"
submitService="Submit using Form Data Model"/>
Once the complete node properties are in place, the files in the folder can be individually overlayed, such as post.POST.jsp, addfield.jsp, etc. Note that overlaying out-of-the-box areas comes with a cost of breaking future compatibility as the overlaid codes will block the future service pack changes from being used. In our case, we only use overlaying to overcome defects identified and while pending hotfix from Adobe.