Show Menu
TOPICS×

17.3 Create a Contact in Microsoft Dynamics 365 using Journey Orchestration & Import data from Microsoft Dynamics

In this exercise, you'll be doing the following tasks:
  • Modify an existing journey, created in Module 6, to enable creation of contact in Microsoft Dynamics 365. For this modification we will be creating an action in Journey Orchestration.
  • Verify the contact is created in Microsoft Dynamics 365 once you have submitted the Registration form on the AEP Demo website.
  • Setup a data flow from Microsoft Dynamics 365 to Adobe Experience Platform using Microsoft Power Automate. Power Automate is a service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data and more.
  • Lastly, you'll test the complete flow and understand how data flows between applications.

17.3.1 Create Contact in Dynamics 365 using Journey Orchestration

In this exercise, you'll edit your existing Journey created in Module 6 of Enablement. This new version of Journey will then create a Contact in Microsoft Dynamics 365 whenever a customer creates an account on the AEP Demo website.
Go to https://experience.adobe.com/#/home . Click to open Journey Orchestration .
You'll then be redirected to the Journey Orchestration homepage. Search for your Account Creation journey, which is named by this naming convention: ldap - Account Creation Journey . This is the journey that you'll update in a couple of minutes.
Before you can update your journey, you need to create a new Action in Journey Orchestration which will update Microsoft Dynamics 365.
To do that, go to Actions .
Click Add to add a new action.
You'll then see this:
Fill out the following fields like this:
  • Name: ldapD365ContactCreation , in this example: joconnorD365ContactCreation
  • Description: Create a Contact in Dynamics 365
  • URL: Your Web API URL/contacts , which looks like this: https://ldapaepdemoXX.crmX.dynamics.com/api/data/v9.1/contacts , in this example: https://joconnoraepdemo2209.crm4.dynamics.com/api/data/v9.1/contacts
Note : Make sure that the Web API URL uses https, or the call will be refused but Microsoft Dynamics
Your action now looks like this:
Next, under Headers you will need to add the following fields:
Key
Value
If-None-Match
null
OData-Version
4.0
Accept
application/json
OData-MaxVersion
4.0
Your action now looks like this:
Next, under Authentication you will add how you connect to Microsoft Dynamics. In this case we will use OAuth2.0.
For TYPE , choose Custom from the drop-down list.
Then add the following payload by clicking on the pencil icon. Roll over the i icon to display the icon to edit the payload.
The payload screen will appear. Use this payload json. You will need to add your own connection credentials, as created in exercise 17.1.
Copy and paste this json:
{
    "type": "customAuthorization",
    "authorizationType": "Bearer",
    "endpoint": "https://login.microsoftonline.com/common/oauth2/token",
    "method": "POST",
    "headers": {
        "content-type": "application/x-www-form-urlencoded"
    },
    "body": {
        "bodyType": "form",
        "bodyParams": {
            "grant_type": "password",
            "client_id": "",
            "username": "",
            "password": "",
            "resource": ""
        }
    },
    "tokenInResponse": "json://access_token"
}

You should now have this:
You'll now add values to the fields with empty strings in this json as based on exercise 17.1:
  • client_id : The Application (client) ID of the Azure SyncContact app, in this example b21da897-49bb-4f6c-8589-306e42bd366f
  • username : The username you use to connect to Microsoft Dynamics 365, which looks like this: admin@aepdemoldapX.onmicrosoft.com , in this example admin@aepdemojoconnor2209.onmicrosoft.com
  • password : The password you use to connect to Dynamics 365, in this example Password_1234
  • resource : The URL of the Dynamics instance, which looks like this: https://ldapaepdemoXX.crmX.dynamics.com , in this example https://joconnoraepdemo2209.crm4.dynamics.com
Click Save
Click Click to test the authentication , and if your payload is correct it should turn green and say that the Authentication was successful.
Next, under Message parameters you will need to add the following payload by clicking on the pencil icon. Roll over the i icon to display the icon to edit the payload.
The Field configuration screen will appear.
Use this payload json.
Copy this json:
{
    "emailaddress1": {
        "toBeMapped": true,
        "dataType": "string",
        "label": "email"
    },
    "firstname": {
        "toBeMapped": true,
        "dataType": "string",
        "label": "fName"
    },
    "lastname": {
        "toBeMapped": true,
        "dataType": "string",
        "label": "lName"
    }
}

Paste it into the Payload window.
Click Save on the Field Configuration window.
Click Save to save your action.
Now you are ready to edit the ldap - Account Creation Journey .
In the top menu, click Home and search for your ldap - Account Creation Journey you created in Module 6.
Click to open the journey and edit it.
Click Create a new version .
Click Create a new version again.
First you will need to remove the End orchestration step. Click End and click the bin icon in the right panel.
Click Confirm .
Now search for your Action from the left panel. Search for ldapMSD365 and your Action should appear under Actions .
Drag your ldapMSD365ContactCreation action onto the canvas, after the Email - Simple Mail object.
You'll then see this.
You now need to edit the Action parameters .
For the EMAIL Parameter, click the pencil/edit icon.
Search for email and select the email field under ldapAccountCreationEvent .--aepTenantId--.accountcreation.email.
For the FNAME Parameter, click the pencil/edit icon.
Search for firstName and select the email field under ldapAccountCreationEvent .--aepTenantId--.accountcreation.firstName.
For the LNAME Parameter, click the pencil/edit icon.
Search for lastName and select the email field under ldapAccountCreationEvent .--aepTenantId--.accountcreation.lastName.
Your action now looks like this.
Click OK .
Re-add the End orchestration. Clear the search term and under ORCHESTRATION , drag End to the next step in the Journey.
Click Ok .
Your Journey should now look like this:
Click Publish .
Click Publish .
After a couple of seconds, your journey will be published and live.

17.3.2 Create your account to test

Open your AEP Demo website and load a brand of choice. Go to the Login/Register -page.
Fill out the form fields and finish by clicking CREATE ACCOUNT .
After clicking CREATE ACCOUNT , go back to your Microsoft Dynamics 365 dashboard and go to contacts. Search for your email-address and you'll find your contact created inside Microsoft Dynamics 365 in real-time.