Sitecore XM Cloud Form Integration with Azure Function as Webhook
Hello everyone, In this blog, we will see, how Azure Function can be used with Sitecore Forms. Before starting, I would request everyone to read my previous blog on XM Cloud Form as I am not going to go deep with how to create forms in XM Cloud.
- Creating Azure Function : Will serve as our Webhook
- Creating and Integrating Form : XM Cloud Form
Creating An Azure Function
I will not explain how you can create Azure Function with Http Trigger. You can check this youtube link here. Also in reference section, I will provide the link how you can connect and deploy your changes to azure function using Visual Studio.
Azure Function Code : Its just a starter code which Azure function by default.
Creating XM Cloud Form and Integrating with Azure Function
Step 1: Create a form from Form Editor and once form us published, you can see the below view in preview state. Here you can edit your form too. But it always recommended to use a version of that form as whatever changes is done will be reflected on live site directly
Step 2:Copy the URL of your Azure function from Azure portal which will be used in Webhook URL property in XM Cloud Form
Step 3:Navigate to Webhooks section in Forms Editor and update the value of URL property pointing to Azure Function URL. In earlier blog, I have explained how to create webhook.
Step 4:Update your XM Cloud form to use the updated webhook. There are two ways you can assign the webhook to the form. Both screenshot are given below. 1. Edit the form by selecting the form and navigating to Setting section. 2. Second is the click the ... of your form in forms list.
Step 4:Test the webhook in preview state.
Step 6: Assign the form to your page. This can be done in two ways. 1. From content Editor 2. From Pages Editor. Refer below screenshot.Make sure the BYOC component is added to your placeholder setting wherever you are intending to add the form.
Content Editor
Pages Editor
Step 7: You can test the form submission from your actual page preview in Page editor once the form is added
Step 8: Publish your page and you can see your form which is ready for testing.If form submission is successful, then you will see the success message
Hope you must have enjoyed this blog.Thanks for reading and Happy Learning!!
You can check my other blogs too if interested. Blog Website
Refernces
Comments
Post a Comment