SOLVED

Form submit via Form API in AEM

Go to solution
Dhanush_Ganesh
Level 2

Form submit via Form API in AEM

Hello there.

 

We use Form API to submit form data into Marketo from AEM. The data gets into MKTO correctly. But the data value in a field isn't. We have a field that gets multi select values. For all the Multi select values, there are multi values as well.

 

For example, if there is are A,B,C as mutli select values, if an user selects A, then Marketo has to get the values as A1,A2,A3. Likewise for B, it should get B1,B2,B3. We know this is possible if we use MKTO LP and MKTO Form. We tried change data value option as well, but even that doesn't satisfy the condition. 

 

Is there a way in AEM to send in correct values into MKTO?

 

Thanks!

Dhanush Ganesh
1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Form submit via Form API in AEM

Yes, that should work too! Marketo doesn't have a multi-select field type OOTB; fields configured as multi-select values on the forms/synced multi-select CRM fields store distinct values delimited by a ";" in the form of a text/string.  To verify this I submitted the formSubmit API endpoint with the below payload:

 

{
    "formId": 1225,
    "input": [
        {
            "leadFormFields": {
                "email": "abc+test@example.com",
                "firstName": "DS-TEST",
                "lastName": "Test",
                "testfield":"value1; value 3"
            },
            "visitorData": {
                "pageURL": "https://example.com/form-page",
                "queryString": "utm_source=google&utm_medium=cpc",
                "leadClientIpAddress": "192.168.1.1",
                "userAgentString": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
                "cookie": "id:xxx-xxx-123&token:_mch-marketo.com-1679072751944-21914"
            },
            "leadSource": "Website"
        }
    ]
}

 

The "testfield" is a string-type field added as a multi-select field on the Marketo form. Post submission, the "testfield" had "value1; value 3" in it as expected. If you don't plan on using this form on webpages, then you might as well set it as a vanilla string type field in the form editor.  Let us know if you have questions.

 

View solution in original post

4 REPLIES 4
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Form submit via Form API in AEM

Here’s an idea: assuming that you aren’t gonna use this form directly on webpages and are just gonna make form submissions using the formSubmit API, then instead of enabling multiple selections on the Marketo form, you can configure the field on the Marketo form as a plain text field and make form submit with all the relevant values delimited by a delimiter itself from AEM. 

Dhanush_Ganesh
Level 2

Re: Form submit via Form API in AEM

Thanks @Darshil_Shah1

In another scenario, what if this form is used in webpages and we have configured this field as multiple select field, will AEM still be able to send in the values with delimiter ?

Dhanush Ganesh
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Form submit via Form API in AEM

Yes, that should work too! Marketo doesn't have a multi-select field type OOTB; fields configured as multi-select values on the forms/synced multi-select CRM fields store distinct values delimited by a ";" in the form of a text/string.  To verify this I submitted the formSubmit API endpoint with the below payload:

 

{
    "formId": 1225,
    "input": [
        {
            "leadFormFields": {
                "email": "abc+test@example.com",
                "firstName": "DS-TEST",
                "lastName": "Test",
                "testfield":"value1; value 3"
            },
            "visitorData": {
                "pageURL": "https://example.com/form-page",
                "queryString": "utm_source=google&utm_medium=cpc",
                "leadClientIpAddress": "192.168.1.1",
                "userAgentString": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
                "cookie": "id:xxx-xxx-123&token:_mch-marketo.com-1679072751944-21914"
            },
            "leadSource": "Website"
        }
    ]
}

 

The "testfield" is a string-type field added as a multi-select field on the Marketo form. Post submission, the "testfield" had "value1; value 3" in it as expected. If you don't plan on using this form on webpages, then you might as well set it as a vanilla string type field in the form editor.  Let us know if you have questions.

 

Dhanush_Ganesh
Level 2

Re: Form submit via Form API in AEM

Thanks @Darshil_Shah1 this is very helpful

Dhanush Ganesh