AEM Forms: Customizing "Submit using Form Data Model"

Avatar

Avatar
Validate 1
Level 1
aemdevn
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
aemdevn
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
aemdevn
Level 1

10-07-2018

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)

AEM Forms API

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Affirm 1
Level 1
radM
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

1 solution
Top badges earned
Affirm 1
View profile

Avatar
Affirm 1
Level 1
radM
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

1 solution
Top badges earned
Affirm 1
View profile
radM
Level 1

28-09-2018

I had this issue.

Solved by creating own FormSubmitActionService service implementation

then

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

hope this helps

Answers (1)

Answers (1)

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

02-10-2018

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