Create an Adaptive Form based on the Sales Force Form Data Model and test the creation of a lead in Salesforce by submitting the form
So, we will now create an Adaptive Form based on the Form Data Model that we had created earlier. So, I’ve logged into my AEM forms instance, going into this folder called SFDC forms and here I’m going to create a form.
Select the template on which the form is going to be based, give a name here so I can call, Create Lead in Salesforce.
Select a team for your form and then associate a Form Data Model, so we are going to use the Form Data Model that we had created earlier and that was sales SFDC and click on Create.
When the form is created, open it in edit mode.
So here is the data source and in the data source you see all the objects that are defined by the Form Data Model. So, to add these objects to our table, here to our form, we simply need to select the root panel and drag and drop the lead object here. So that brings across all the elements of the lead object onto the form. And if you see, they are arranged one over the other. The next thing we need to do, is to add a Submit button to our form. So, let’s add a Submit button, that’s the Submit button. So if you want these fields to be in a two column layout it’s quite easy to do that, so you can select the Layout mode from the form here and then select any of these objects and go to its parent object, that is the lead panel and from here you can specify how many columns you want in your panel. I’m going to select two columns, then these fields get arranged in a two-column layout here. Then you can go back to your Edit layout.
So, so far, we have added the objects from our Form Data Model and configured them in a two-panel layout and we have added a Submit button. Next thing we need to do is to configure our form so that it creates a lead in the Salesforce database when the form is submitted. So, to do that, I go into the Content Explorer for form, select the Form Container node and click on the Properties sheet here.
So here we need to go to the submission options and select the Submit action, submit using Form Data Model and here we need to select what kind of object you want to submit or in our case we are going to submit the lead object, so select that, so the data model to submit is /Lead, here.
And then on submission, you want to show a form, another form which shows a successful message. So, for that, I’m going into my Forms and Documents, Adaptive form, SFDC form and I’ll select a thank you message here.
So, when the lead is successfully created, we’ll get this Thank You form displayed to the user. So, our form is now configured here, so save on these settings here and let’s review the form in a HTML format. So here, preview as HTML and enter some values here, so I’m going to enter this and call it here say, TTR, name and the lead source is going to be Web and the email is let’s say, email@example.com.
And then when I submit, it should create a lead and I should get a Thank You page here. So that’s the Thank You form that I got and the lead should be in the database. So, this is my Salesforce and if I were to refresh this, I see this newly created lead that was using the data from the Adaptive Form that was submitted. So, this is how you can easily integrate AEM forms with Salesforce or any other third-party application that you may have using our Form Data Model integration capabilities. -