Highlighted

Submit PDF and json/xml to 3rd party system from Adaptive form

Ron_PreForm_IT

15-01-2020

I have been working with Livecycle before, but now I'm doing some AEM Forms 6.4 and have no clue to solve this. Could you help me with some guidiance?

I want to have a adaptive form that the user can fill in. After the user has filled it in, they should be able to click "Submit" and we send an PDF and json/xml(of the data in the form) to a 3rd party system and redirect the user to a "thank you"- page with the PDF that they can download.

I have created a adaptive form thats sends a post, but where do I add the PDF, json/xml and redirects it?

Replies

Highlighted

Mayank_Gandhi

Employee

15-01-2020

You have multiple option in the out of the box submit. You can probably use the submit to rest endpoint and map the post URL in the field. You will have to iterate the request parameter on the servlet that it submits to and send it further as required. You can configure the thank You page as well in the same submit action.

 

https://helpx.adobe.com/in/experience-manager/6-3/forms/using/configuring-submit-actions.html

Highlighted

Ron_PreForm_IT

16-01-2020

Right now my POST looks like this

------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="guideContainerPath" /content/forms/af/submittest/jcr:content/guideContainer
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="aemFormComponentPath"
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="_asyncSubmit" false
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="_charset_" UTF-8
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="runtimeLocale"< en
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="fileAttachmentMap" {}
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="afSubmissionInfo" {"computedMetaInfo":{},"signers":{}}
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="name" John Doe
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="jcr:data" <?xml version="1.0" encoding="UTF-8"?>
<afData><afUnboundData><data><name>John Doe</name></data></afUnboundData><afBoundData><data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"/></afBoundData><afSubmissionInfo><computedMetaInfo/><signers/><afPath>/content/dam/formsanddocuments/submittest</afPath><afSubmissionTime>20200116013642</afSubmissionTime></afSubmissionInfo></afData>
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="jcr:data@TypeHint" Binary
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name=":redirect" /content/forms/af/submittest/jcr:content/guideContainer.guideThankYouPage.html
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name=":selfUrl" /content/forms/af/submittest
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="_guideValueMap" yes
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="_guideValuesMap" {"name":"John Doe","button1579175911492":null,"reset":null,"saveGuideDraft":null,"submit":null}
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name="_guideAttachments"
------WebKitFormBoundarypl5WMcXXSIhKex0X
Content-Disposition: form-data; name=":cq_csrf_token" eyJleHAiOjE1NzkxNzk3MDMsImlhdCI6MTU3OTE3OTEwM30.fOaF2_mbWw-Q8-mZJwJXxfJPZPi8xYVDcsmKW2ne-s4
------WebKitFormBoundarypl5WMcXXSIhKex0X--

 

The problem is that I don't know where to programmatically write what I want to send. Normally I would write an XMLHttpRequest in the button in javascript and grab the XML data and the PDF and send it. Now I don't know how I send the DOR (the filled in web form as a PDF).