Creating a custom trigger in Dynamics 365 Marketing's real-time journeys enables you to respond instantly to specific customer actions or events, enhancing engagement and personalization. Here's a step-by-step guide to creating and integrating a custom trigger.

We have 2 triggers

1. Custom Trigger

A custom trigger is a manually created event that is fired when an external system, app, or process sends a signal to Dynamics 365.

Key Features

Example Use Cases

2. Record-Related Trigger

A record-related trigger is automatically triggered when a specific Dataverse record (e.g., Contact, Lead, Opportunity) is created or updated.

Key Features

Example Use Cases

Step 1. Login to CRM.

Step 2. Name the trigger: Test Custom Trigger.

Step 3. Select Contact in Data Type and click the Next button.

Next button

Step 4. Click the Next button.

Click Next button

Step 5. Click the Ready to Use button.

Ready to Use button

Step 6. The name of the trigger can be checked with below Screenshot.

Trigger Name: msdynmkt_testcustomtrigger_103112499

For C#

Trigger Name

For Java Script

For Java Script

Code

using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Globalization;
using System.Net;
using System.Reflection;

namespace IMSDynamicsWebhooks.Trigger
{
    public class TriggerService
    {
        private readonly IOrganizationService Service;

        public TriggerService(IOrganizationService service)
        {
            Service = service;
        }

        public const string MarketingTrigger = "msdynmkt_testcustomtrigger_103112499";

        public void ExecuteTrigger(Entity contact, string marketingTrigger)
        {
            DateTime currentDateTime = DateTime.Now;
            OrganizationRequest customTrigger = new OrganizationRequest
            {
                RequestName = MarketingTrigger
            };

            customTrigger.Parameters.Add("msdynmkt_bindingid", contact.Id.ToString());
            customTrigger.Parameters.Add("msdynmkt_signaluserauthid", contact.Id.ToString());
            customTrigger.Parameters.Add("msdynmkt_signalingestiontimestamp", currentDateTime);
            customTrigger.Parameters.Add("msdynmkt_signaltimestamp", currentDateTime);
            customTrigger.Parameters.Add("msdynmkt_profileid", contact.Id.ToString());

            Service.Execute(customTrigger);
        }
    }
}

Step 7. Record-related Triggers can be created like below screenshot.

Record-related