You can quite easily integrate data coming from forms on your web site with Dataverse using some simple Javascript and Power Automate Cloud Flows.
First step is to create a Power Automate Flow with a "When a HTTP request is received" trigger and add the form fields that you want to capture as JSON payload. Remember to start creating your flow from within a solution so that you can leverage the ALM capabilities of Dataverse and use the new Dataverse connector (current environment)
The request body JSON schema should contain all the web form fields that you want to sent to Dataverse/Dynamics 365 - below is the JSON schema that I generated from a sample payload.
{ "type": "object", "properties": { "firstname": { "type": "string" }, "lastname": { "type": "string" }, "phone": { "type": "string" }, "email": { "type": "string" }, "message": { "type": "string" } } }
function submitform() { var emailvalue = document.getElementById('emailvalue').value; var firstnamevalue = document.getElementById('firstnamevalue').value; var lastnamevalue = document.getElementById('lastnamevalue').value; var phonevalue = document.getElementById('phonevalue').value; var messagevalue = document.getElementById('messagevalue').value; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST","yourcloudflowurl"); xmlhttp.setRequestHeader("Content-Type","application/json;charset=UTF-8"); xmlhttp.send(JSON.stringify( { firstname: firstnamevalue, lastname: lastnamevalue, phone: phonevalue, email: emailvalue, message: messagevalue } )); alert("Thank you"); }
No comments:
Post a Comment