Expand my Community achievements bar.

How to create a custom submit action similar to the OOTB Send email action?

Avatar

Level 2

AEM 6.5.19 with AEM Forms installed.

I'm working on creating a custom submit action for forms so that I can decide if a form's email should go to email1 or email2 based on a form value.  It should just be a copy of the OOTB Send email submit action with a small bit of custom code added.  I've been working from ⁠this example, but it doesn't provide many answers.

It doesn't add any file attachments or run any token replacement for the subject and template.  I'd like to just extend the Send email action so I don't miss out on any of that functionality.  Any way I could do that?

I looked at /libs/fd/af/components/guidesubmittype/email/post.POST.jsp, but that seems to encapsulate all it's code inside "af.mail.jsp".  

 

GuideSubmitUtils.setForwardPath(slingRequest, resource.getPath(), "af.mail.jsp", null);

 

Where would I find "af.mail.jsp" so I could take a look at it?

 

2 Replies

Avatar

Level 2

 

Are email1 and email2 part of form definition?

 

You can use AEM workflow for writting business logic to use email1 or email2 instead of custom function.

 

 

Avatar

Level 2

email1 and email2 are fields I added to my custom submit action.  They are NOT defined in the Adaptive Form for the end user to fill out.