Case Study: you have a company site hosted on a CMS (let’s assume WordPress for the purpose of this). You want to capture inquiries from the public, and create Leads in your Dynamics 365 for Sales.

Technologies: WordPress site (you must be able to create plugins) or any other public site, Logic Apps, Dynamics 365 for Sales.

On your WordPress site you have a plugin that collects the Lead details and pushes then to a HTTP end-point. This is a JSON with a payload containing the Lead details. I’ll let the WordPress gurus figure this one out, but if you run a search for WordPress form to JSON plugin you will find several results of already existing plugins.

On your Azure Portal, find Logic Apps and create a new app. Once your app is created (it only takes a few moments), go into designer and create a blank Logic App. Search for HTTP and find HTTP Request.

LogicAppsHTTPRequest

Define the schema. You can either use a sample data set, or create it manually. I would recommend creating it manually, as you can use it to validate the payload is formatted as expected.

LogicAppsHTTPRequestSchema

Once you save, the URL will be defined. This is the URL you will configure in your WordPress Plugin.

For the sake of simplicity, I’m only capturing first and last name, email, phone and topic, all mandatory. My schema would look like this:

{
"type": "object",
"properties": 
   {
      "firstName": {"type": "string"},
      "lastName": {"type": "string"},
      "email": {"type": "string"},
      "phone": {"type": "string"},
      "topic": {"type": "string"}
   },
  "required": ["email","firstName","lastName","phone","topic"]
}

Next add a new step, find Dynamics 365 and select “Create a new record”.

LogicAppsD365CreateNewRecord

Sign in to your D365 instance, and select Leads from the drop-down. Now you can start populating the fields with the values received from the request.

LogicAppsD365CreateNewLead

Now your Logic App is created. Go back to the HTTP request definition and copy the URL.

You can test this by passing the payload using Postman, or you can do it directly from your WordPress plugin. You can monitor the execution in Logic Apps, and then confirm the new Lead created in Dynamics 365 for Sales.

LogicAppsRun
DynamicsRecordCreated

Other than a simple JSON schema definition, no code required. Easy as pie.

Enjoy!

Advertisements