The forms module allows integrations with 3rd party systems, including CRMs and payment gateways.
Custom form submission
You can configure a form built with the Contensis forms module to post its data to a custom URL. The default behaviour is to continue to post data to the Contensis forms service, which will create the form post and any other processes such as file uploading and notifications.
By posting the data to a custom URL, you can handle the form submission any way you choose. This gives you the flexibility and ease of use of our form builder, but the scope to perform any custom behaviour you would like.
The Post to Custom URL option is available on the Form Settings tab of each form allowing you to customise it on a per-form basis.
When selecting the Post to Custom URL option, you will see options to enter the URL and to indicate whether you want the form responses saved to Contensis.
Accepted URL Types
The Post to Custom URL option can be set to an absolute URL where the post will be routed to the absolute URL you have specified e.g.
Convention based routing
Alternatively, you could use Convention Based Routing and supply the name of an Api Controller that exists within your website, such as:
Post to Custom URL
|Post to Custom URL
This means that if you create a Contensis form and want to post the results to your MicrosoftDynamicsCRM Controller, then you should set the Post to Custom URL setting to /MicrosoftDynamicsCRM/ and create an ApiController looking like this:
You can see the class has the name you have specified in the Post to Custom URL set in the form, but with a ‘Controller’ suffix. This is a standard convention within MVC so will be familiar to developers.
Handling form posts - ContensisFormsApiController
Contensis ships with a specific implementation of an ASP.NET WebAPI 2 Controller called ContensisFormsApiController. We recommend that when you are extending a Contensis form in this way, that you always inherit from this ApiController as it handles some of the heavy lifting for you.
The ContensisFormsApiController itself fulfils the following functions:
- Uses Convention Based Routing to make it easy for you to hook it up the Custom URL specified in the Form Settings for your form.
- Allows you to suppress the creation of a form post for a given form - useful for initial development and debugging.
- Allows you to update a form post with new data.
- Gives access to the created form post via the FormPost property.
An example empty template ContensisFormsApiController is shown below:
Updating form posts
As seen in the previous example, you can also update form posts. Any fields within your form can be updated.
Another potential use for this facility is having a form on your website which is used to collect personal information from your users and what products or course they may be interested in.
Using the UpdateFormPost method, you will be able to collect that information, create a form record within Contensis, add a record in to a CRM system marked as being a lead or potential student, then update the Contensis Form Post information with the CRM ID of the lead.
The UpdateFormPost method exists in the Base Class ContensisFormsApiController and it is this where the update to the form data is performed.