Create an Adaptive Form based on the Sales Force Form Data Model and test the creation of a lead in Salesforce on the click event of a button
Hi, in the previous video we saw the creation of a lead when a form was submitted using the form data model submit metric. In this video we will create a lead on the click of a button without submitting the entire form. So, to do that I have opened the same form in edit mode and I’m going to go to the data sources tab of my form and drag and drop the Salesforce result object onto my root panel here. Okay.
So, I get the ID object into my form here and that is coming from the ID field under the SF result object. Next thing we need to do is to add a simple button here. So, let’s add a button, a button and on the click of this button we are going to insert the lead in Salesforce. So, let’s change the properties of this button to call it, create lead. Here’s the title. So, instead of the default button we’ll call it create, create lead. Okay, and then we need to configure the rule editor to invoke a Salesforce post operation that will create a lead in Salesforce. So, select this button here, click on the edit tools and click on the create.
Make sure you always see the form objects and functions here. And here is you’re saying when the create lead button is clicked then invoke service and that service is going to be the post operation of our form data model. So, that’s the post operation and the moment you select that the input and the output parameters will be listed here. So, the input parameters are going to be the phone, company name, last name, first name and the email. So, you can simply drag and drop these objects from here onto these things here like the name and then the company, last name, first name of the lead that you want to create and then the lead source and then the lead email here, and then the lead email and the output of the operation will be an ID of the lead object that was created so that you may want to display in this field that we had put on the form here, right. So, we are going to ignore that enable error validation on server for now. And once you’re done with this save, save and then we can do a preview of our form here. So, let’s do a preview of the form as HTML.
And now you see two buttons, one is for submitting the form and the other one is creating a lead by clicking on this button. So, if I enter some values here and then the company is, let’s say LDI and the lead sources it can give some value here and the email can be email@example.com.
Okay, and now if I click on create lead it should call the post operation of my form data model and create a lead in the Salesforce database and return me the ID and that is populated in here. So, this is how you can also create a lead in the underlying data source without having to submit the entire form. You can simply do the same operation on the click of a button. -