17.4 Update a contact in Microsoft Dynamics 365 and automatically trigger a journey

17.4.1 Create a segment in Adobe Experience Platform for customers with a negative sentiment

Go to Adobe Experience Platform.

demo

In the left menu, go to Segments.

demo

In Segments, click + Create Segment.

demo

In Attributes, click XDM Individual Profile.

demo

Click your tenant specific object, which is similar to --aepTenantIdSchema--.

demo

Click sentiment.

demo

Drag and drop sentiment onto the canvas.

demo

Enter the value Negative.

demo

Go to Events and click XDM ExperienceEvent.

demo

Click your tenant specific object, which is similar to --aepTenantIdSchema--.

demo

Click brand.

demo

Drag and drop ldap to the canvas.

demo

Enter your ldap.

demo

Use this naming convention to name your segment: ldap - D365 Sentiment: Negative, in this example that should be vangeluw - D365 Sentiment: Negative.

demo

Click Save. After clicking Save, you’ll be redirected here:

demo

17.4.2 Configure a journey to trigger when sentiment becomes negative

Go to https://experience.adobe.com/#/home. Click to open Journey Orchestration.

JO

You’ll then be redirected to the Journey Orchestration homepage. Click Create to create a new journey.

JO

You’ll then see this.

JO

Enter a name for your journey. Use this naming convention: ldap - D365 Sentiment: Negative, which in this example becomes vangeluw - D365 Sentiment: Negative.

Click OK.

JO

From the left menu, drag and drop the Segment Qualification event onto the canvas.

JO

Click the Edit icon to select a segment.

JO

In the popup, select the segment you created in exercise 17.4.1, which was named ldap - D365 Sentiment: Negative.

Click Save.

JO

Click OK.

JO

In the left menu, go to Actions and search for the action smsTwilioLdap that you created in module 12.

JO

Drag and drop the action smsTwilioLdap onto the canvas as the next step in your journey.

Click on the Edit icon for the Action Parameter TEXTMESSAGE.

JO

You’ll see a popup with the Simple Mode Editor.

JO

In the popup you’ll see, click on Advanced Mode. You’ll then see this.

JO

Paste this code in the Advanced Mode Editor. Click OK.

In this text message, you’ll use the customer’s first name. You can either select the path to the field First name, or you can copy and paste the below text.

FYI: If you paste the below text, please verify the path as it’s possible that in your Adobe Experience Platform instance, the data source and field group are named in a different way.

#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName} + ", we'd like to apologize for the negative experience you had. We're looking into this and we'll contact you in the next 2 business days."

JO

You should now have this. Click OK to save your changes.

JO

Next, click on the Edit icon for the Action Parameter MOBILENR.

JO

You’ll see a popup with the Simple Mode Editor.

JO

In the popup you’ll see, click on Advanced Mode. You’ll then see this.

JO

Paste this code in the Advanced Mode Editor.

substr(#{ExperiencePlatform.ProfileFieldGroup.profile.mobilePhone.number}, 0, 12)

FYI: This code is intended to work with mobile phone numbers that have 12 digits (including the +), like this one: **+32463622044`.
Several other countries have 13-digit phone numbers. If your mobile phone number has 13 digits (including the +), you need to update this code to:

substr(#{ExperiencePlatform.ProfileFieldGroup.profile.mobilePhone.number}, 0, 13)

Click OK to save your changes. You’ll then have this.

Click OK once more.

JO

Next, in the left menu, go to Orchestration.

JO

Drag and drop the orchestration event End onto the canvas. Click OK

JO

Your journey is ready to be published now. Click Publish.

JO

Click Publish again.

JO

Your journey is now published.

JO

17.4.3 Create automation using Microsoft Automate (Flow) to listen to the sentiment change

After creating a journey that will trigger when customer sentiment changes, you’ll now create a flow in Microsoft Power Automate that will listen to a change to the sentiment field in Microsoft Dynamics 365 and then send an update to the Real-time Customer Profile in Adobe Experience Platform.

Go to https://flow.microsoft.com. Sign in with the Microsoft account you created in exercise 1.

You’ll be redirected to the Microsoft Power Automate home screen.

Automate

In the top right menu bar, click Environments and select the environment you just created.

Automate

In the left menu, click My Flows.

Automate

Click + New, then click Automated - from blank.

Automate

In Choose your flow’s trigger, search for common. From the result list, select When a record is updated

Automate

Click Create.

Automate

You will be redirected to the Flow creation screen.

Automate

Select these settings:

  • Environment: select Adobe(aepdemoldapX)
  • Entity Name: select Contacts
  • Scope: select User

Automate

Click + New step.

Automate

Click Condition form the list of available actions.

Automate

You will now see the Condition field and Yes/No options

Automate

In the Condition panel, click the Choose a value field and start searching for the Sentiment you created in Dynamics

Automate

Click Sentiment Value and you’ll see it assigned into the Condition.

Automate

Set the operator to is not equal to.

Automate

Click in the Choose a value field and select the Expression option

Automate

Type null and click OK.

Automate

Your Condition now looks like this:

Automate

Next, you’ll enter the If yes expression.

Click Add an action in the If yes expression.

Automate

From the Choose an action, search for HTTP.

Automate

Click the HTTP PREMIUM option.

Automate

You’ll now see the expression builder options.

Automate

Follow these instructions to set the fields of the HTTP expression builder:

  • Method: POST
  • URI: --dcsInletId--

Enter the following Header values

Header Value
Content-Type application/json
Accept-Encoding gzip, deflate, br
Connection keep-alive
Accept */*

You should now have this:

Automate

At the point it is good to save the Flow. Enter the name AEP Demo - Sentiment Event in the title field.

Automate

Next, you need to enter the Body of the HTTP request.

Copy the below payload.

{
  "header": {
    "datasetId": "--msftProfileDatasetId--",
    "imsOrgId": "--aepImsOrgId--",
    "source": {
      "name": "D365 Sentiment Change"
    },
    "schemaRef": {
      "id": "https://ns.adobe.com/--aepTenantIdSchema--/schemas/--msftProfileSchemaRef--",
      "contentType": "application/vnd.adobe.xed-full+json;version=1"
    }
  },
  "body": {
    "xdmMeta": {
      "schemaRef": {
        "id": "https://ns.adobe.com/--aepTenantIdSchema--/schemas/--msftProfileSchemaRef--",
        "contentType": "application/vnd.adobe.xed-full+json;version=1"
      }
    },
    "xdmEntity": {
      "--aepTenantId--": {
        "identification": {
          "crmId": "@{triggerOutputs()?['body/contactid']}",
          "emailId": "@{triggerOutputs()?['body/emailaddress1']}"
        },
        "sentiment": {
          "sentiment": "@{triggerOutputs()?['body/_new_sentiment_label']}"
        }
      },
      "person": {
        "name": {
          "firstName": "@{triggerOutputs()?['body/firstname']}",
          "lastName": "@{triggerOutputs()?['body/lastname']}"
        }
      },
      "personalEmail": {
        "address": "@{triggerOutputs()?['body/emailaddress1']}"
      }
    }
  }
}

Click Save.

Automate

To test your automation, go back to your Microsoft Dynamics 365 Dashboard, and go to Contacts. Open the contact record for the profile you created on the AEP Demo website as part of the previous exercise.

JO

Scroll down to the Sentiment field and change the value for that customer to Negative. Lastly, save your changes.

Automate

By saving your changes in Microsoft Dynamics 365, an automated request will be sent from Microsoft Dynamics 365 to Adobe Experience Platform which will update the Real-time Customer Profile in Adobe Experience Platform and as a consequence, your journey in Journey Orchestration will be activated. You should now receive the text message within minutes.

Automate

Next Step: Summary & benefits

Go Back to Module 17

Go Back to All Modules

On this page