Add Dynamics 365 Marketing Trial To Your Instance

 

Here is the step by step process for adding Dynamics 365 Marketing to your dynamics 365 instance.
You can sign up for, install, and use a trial version of Dynamics 365 Marketing for free. Trials last for 30 days.

Few important points to remember :

  • You will receive a trial Dynamics 365 instance together with your Marketing trial. You must run the Marketing trial on a trial instance, and can’t install it on a production instance.
  • You can’t convert a trial instance into a production instance.
  • You can install, at most, one Dynamics 365 Marketing trial per Microsoft 365 tenant.
  1. Go to the admin platform of your tenant:  https://admin.powerplatform.microsoft.com/  
    Expand Admin centers and click on Dynamics 365:
    1

  2. In Dynamics 365 Admin centre, click on Applications tab  –> Select Dynamics 365 Marketing Application  –> Click on Manage:
    2

  3. Otherwise access this url directly :  https://port.crm8.dynamics.com/G/Applications 
    [Replace crm8 with appropriate region]. Follow the steps given on step 2. 

  4. On the next screen you will be asked to provide a portal name, Please note that a portal is needed to host your pages which can be accessed by customers publically. In this installation a portal of type “Events” will be created for us.
    3


  5. On the next screen, wait a few seconds:
    4

  6. Another important step : You must provide a physical address of the organization ; In our case its a trial, you can put it in anything and also accept the data consent.
    6

  7. The installation will start, though it says it will take approx 10 mins, I would suggest you leave it for sometime and come back later. 
    5
  8. Once that is done, You will see something like below:
    7


  9. And its done! Now to access the app, you can click on “Go to app” from the above screen or simply navigate to “Marketing” App from your dynamics 365 instance navigation as it will start appearing post installation:
    9

 

Hope this helps.

Cheers!

Advertisement

Get Contacts/Customers Used In A Customer Journey In Dynamics 365 Marketing

This is going to be a very short blog as I am going to just reference my previous blogs to achieve a solution for this.

I have talked about Customer Journey entity in dynamics in a recent post here:  The ‘Mysterious’ Customer Journey Entity In Dynamics 365 Marketing.

By now, we know that it’s not easy or straight forward to get any details from a customer journey from the back-end.

segment1

In a customer journey, customers are not directly added but rather through a “Marketing Segment”. Now we have seen in the blog above on how to get segment details used in the journey. Once we have the segment Id, the next step is to fetch the customers from the segment and for that I have another blog explaining it: Dynamics 365 For Marketing – Retrieve Contacts From A Segment

By doing the above mentioned, you should be able to get all customer that are part of a journey.

I hope this helps.
Cheers!

 

The ‘Mysterious’ Customer Journey Entity In Dynamics 365 Marketing

In today’s blog I am going to be talking about ‘Customer Journey’ entity in dynamics 365 for marketing app or to be specific the ‘Customer Journey Designer’ which looks like below:

customerjourney1

 

I call it ‘Mysterious’ because whatever happens in the journey ‘stays’ in the customer journey. i.e there is no way or its difficult to get the segment/contents being used in it. I am talking about Marketing Email, Marketing Page, Marketing Form etc. The question you might want to ask is why would I need that information? well, because of may be below:

  1. You might have some validations on the content you can use in the customer journey
  2. You might want to retrieve the data for reporting purpose

If you look into the relationships from customer journey to these entities, you wont find anything hence it gets difficult to retrieve these records or perform operations. In short Dynamics 365 Marketing works a little differently then our typical dynamics 365.

Whatever happens inside a customer journey designer sits in a field on this entity named as “msdyncrm_workflowdefintion“. It stores information about content added in this the journey in JSON format. 

customerjourney2

This is how it looks:
customerjourney3

 

Let’s understand what this JSON means:

  1. Each content is stored in a node called “ActivityTypeId“.
  2. The Id of the content is stored in property “Itemid“.
  3. To identify the type of content such as Marketing page form etc. refer to below table because it uses different names to each type of content:

Dynamics Entity Name Internal Name In Customer Journey
Marketing Page LandingPage
Marketing Form MarketingForm
SurveySurvey
Marketing EmailEmail
Marketing Event Event
Marketing SegmentSegment

If you debug and parse this field data into JSON, looks like something below:

customerjourney4

So when you retrieve/query this field, you have to loop through these JSON nodes and do validation using the Guids of these records like in the below example of Javascript:

 var workflowDefintion= formContext.getAttribute("msdyncrm_workflowdefinition").getValue();
 var workflowDefintionData = JSON.parse(workflowDefintion); //Parse it

                    var nodeLength = workflowDefintionData.length;
                    for (var i = 0; i < workflowDefintionData.length; i++) {
                        var node = workflowDefintionData[i];                        
                        /* Check if node is a Marketing page*/                       
                        if (node.ActivityTypeId === "LandingPage" && (i + 1) === nodeLength) {

// Perform Operations here
}

Same way you can do in the code if needed.

I hope this help!

Cheers!

Import Member/Contacts To A Marketing Segment

A segment in 365 for marketing app is an essential feature which lets you create a list of related contacts based on some criteria( similar to advanced find). Later it is used to target customers in a customer journey.

While you can define a criteria/search for contacts and add them in a Dynamic segment, you don’t have this facility in a “Static” Segment because contacts are manually added on a per-contact basis. hence, there should be ability to import these contacts in to a static segment. 

Now, there is no out of the box way I could find by which we can bulk update contacts into a segment, however after doing a bit digging, I found a working custom solution. 

Solution

If you look into segment entity, you will find a mysterious field named “msdyncrm_segmentmemberids” as below:

segment1

This field basically consists of the ids of the contacts in a JSON format prefixed with “crm”:

segment2

Hence, whatever contacts you manually select on the segment comes and sit in this field. So we just need to update this field with ids of the contact we want to include in this segment.

You can update this field either by WebApi or a Plugin. Its upto you how you want to design your solution. In my case I have placed button on the segment form which opens a web resource providing a flexibility to upload an excel/csv file containing these ids of the contacts which you can easily read, prepare the format of the guids(prefix with “crm”) and update using a simple web api request.

 var entity = {};
            var stringIfy = JSON.stringify(Prepared_ContactsArray);
            var entity = {};
            entity.msdyncrm_segmentmemberids = stringIfy;

            var req = new XMLHttpRequest();
            req.open("PATCH", GetGlobalContext().getClientUrl() + "/api/data/v9.1/msdyncrm_segments(" + segmentId + ")", true);
            req.setRequestHeader("OData-MaxVersion", "4.0");
            req.setRequestHeader("OData-Version", "4.0");
            req.setRequestHeader("Accept", "application/json");
            req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
            req.onreadystatechange = function () {
                if (this.readyState === 4) {
                    req.onreadystatechange = null;
                    Xrm.Utility.closeProgressIndicator();
                    if (this.status === 204) {
                        //Success - No Return Data - Do Something
                       
                    } else {
                        //Xrm.Utility.alertDialog(this.statusText);
                    
                    }
                }
            };
            req.send(JSON.stringify(entity));
        }

I hope this helps!

Cheers!

Enable Custom Entities For Marketing Segment Dynamic Query

A segment in 365 for marketing app is an essential feature which lets you create a list of related contacts based on some criteria( similar to advanced find). Later it is used to target customers in a customer journey.

So when you create a new segment you have an option to create it as static or dynamic. A dynamics segment is what lets you add a query to filter contacts.

picture depicts a dynamic segment query designer

However, there is one thing that will bother you which is, it will not let you add a related custom entity to form a query ( click on add group and select union as relationship)

Solution

There is a settings available in Marketing app which will let you enable this feature for any entity in your system. To check this, go to Marketing App — > Settings Section:


Under Marketing Settings, click on advanced settings.
Now click on Customer Insights Sync under marketing setting section which will give you the list of entities on the right side with check boxes.

Enable for the entities which you need and click on publish from the header.

You might see the box is grayed out and you will not have option to enable. To enable the box you need to enable the change tracking on that entity. to do that you have to go to that entity definition and enable change tracking check box. https://docs.microsoft.com/en-us/power-platform/admin/enable-change-tracking-control-data-synchronization

Once published give it some half an hour.

Navigate to your query now and you will be able to add related entities to your query just like advanced find.

I hope this helps!

Dynamics 365 For Marketing – Retrieve Contacts From A Segment

I had a hard time trying to figure out a way to retrieve members from a marketing segment in my code.

The link-entity between contact and msdyncrm_segment isn’t materialized in CRM. I even raised it here :Basic operations on segments using the Segmentation API

Solution:

Finally fetch xml came to rescue. You can use below xml which can be executed by WebAPI or Organization service and it works on both static and dynamics segments.

<fetch version="1.0" output-format="xml-platform" mapping="logical" returntotalrecordcount="true" page="1" count="5000" no-lock="false">
<entity name="contact">
<attribute name="fullname"/>
<attribute name="contactid"/>
<order attribute="fullname" descending="false"/>
<link-entity name="msdyncrm_segment" from="msdyncrm_segmentid" to="msdyncrm_segmentmemberid" alias="bb">
<filter type="and">
<condition attribute="msdyncrm_segmentid" operator="eq" uitype="msdyncrm_segment" value="bfc9d5d6-d6aa-e911-a859-000d3a3159df"/>
</filter>
</link-entity>
</entity>
</fetch>

Now lets try to execute this first in web api.
Use below format : https://orgurl/api/data/v9.1/contacts?fetchXml=<xml here>
1

Now lets try to execute this using organization service, note that i am using paging here because the number of records can be more than 5000:

var fetch = @"<fetch version='1.0'  page='##pagenumber##' count='5000' no-lock='true'>
<entity name='contact'>
<attribute name='fullname'/>
<attribute name='contactid'/>
<order attribute='fullname' descending='false'/>
<link-entity name='msdyncrm_segment' from='msdyncrm_segmentid' to='msdyncrm_segmentmemberid' alias='bb'>
<filter type='and'>
<condition attribute='msdyncrm_segmentid' operator='eq' uitype='msdyncrm_segment' value='6f5846d5-e5ae-e911-a84b-000d3a802d92'/>
</filter>
</link-entity>
</entity>
</fetch>";



 var contactss = organizationService.RetrieveMultiple(new FetchExpression(fetch));                  
                        foreach(var contact in contactss.Entities)
                        {
                            var id = contact.ToEntityReference();
                            Console.WriteLine(contact.GetAttributeValue<string>("contactid"));
                        }

result:
2

Apart from this fetch xml there is no way to retrieve members from the segment.  There are some issues and limitation i faced during this operation, will try to share them in another post.

I hope this helps!