Dynamics / Click Dimensions – Tip for handling Potential Data Quality Issues

On many occasions we rely on external ISV’s such as Click Dimensions for marketing any event happening in the organisation from Dynamics.

One issue that we often face is how to ensure data quality of the contacts being created in Dynamics from such ISV’s.

For example in one such instance below, we are using Click Dimensions to capture registrations for a contact in Dynamics.

Registration Updated.PNG

Now the challenge is, when it comes to mappings,  Organisation is a lookup in Dynamics but in the Web Content , we can only expose it as a free text. This can cause potential data quality issues, as if the name of organisation does not exactly matches the name in Dynamics , it will not link the Contact with the Organisation.

A potential solution would be to create a custom workflow assembly and follow the mentioned below steps

a) On the Web Content add a mandatory field of Organisation Web Site. In the formatting, using Regex expression, section ensure that users enter the web address in a predetermined format. In the below screenshot, we are doing a custom regex to ensure that no relative paths are present in the URL. This helps us in identifying the parent organisation better.

WebSite Formating.PNG

b) Write a custom workflow on create of contact, and do a lookup on the existing organisations present in the system. If we find a match on the web site link the organisation to the registered contact.

c) Finally to keep organisation web site data clean in Dynamics, enable duplication detection rules in Dynamics.

 

 

 

 

Advertisements

Dynamics Portals – Error on Entity Form Multiple Controls Same ID were Found

While configuring the entity form in portal we were getting an error “Error in Creating Control ID, as multiple controls with the same ID were found.

After analysis we found that when a lookup attribute in Dynamics is rendered in portals, there are three separate controls . One for the ID, one for text and one for entity name. For example, if the attribute name in Dynamics is “abcd_entity”, when the control is rendered in portals it will have the mentioned below controls

a) abcd_entity_name – For text part of the lookup attribute

b) abcd_entity_id – For ID part of the lookup attribute

c) abcd_entity_entityname – For entityName of the lookup attribute

In my case the control ID “abcd_entity_name” was conflicting with the name of an existing optionset attribute in Dynamics. This was causing duplicate ID’s in the system and was this causing the error on the portal.

When we recreated the optionset attribute so as to give it a different name, the above error got resolved.

.Net / C# Waiting for Multiple Async Responses

While writing programs we can often come across situations when we must wait for results from different asynchronous calls. This is required when the processing is dependent upon multiple responses from external medium like web services. Lets look at the mentioned below code example

public async Task ExecuteMultipleRequestsInParallel()
{
    HttpClient client = new HttpClient();
    Task google = client.GetStringAsync("http://www.google.com");
    Task bing = client.GetStringAsync("http://www.bing.com");
    Task yahoo = client.GetStringAsync("http://yahoo.com/");
    await Task.WhenAll(google, bing, yahoo);
}

In the above code , we are executing asynchronous calls to different servers. Suppose we must wait for output from all of them before we can proceed ahead we can use the statement “WhenAll”. This will ensure that the compiler will wait for responses from all the three asynchronous calls before the processing can move ahead.

.Net / Dynamics – Handling Unmanaged Code With “Using” Block

Just wanted to share a coding tip which can help in improving the performance of .Net applications. As Dynamics custom code is build on .Net its helpful in that space as well.

In .Net we can have both unmanaged and managed code. For the sake of keeping the blog short, we will not go into difference between them however, a managed code in dot net is the one in which CLR or “Common language Runtime” automatically reclaims the memory while for unmanaged code such as “SQL Connection”, “File IO Operation” objects CLR does not automatically does that.

In Dynamics, OrganisationServiceProxy object is an unmanaged code resource.

If we are using unmanaged resources, unhandled  exceptions can be very harmful. They can lead to issues related to dangling memory, unclosed connections to file objects etc.

For example, in the above example where we have written a “Dispose” method to free up the memory. Suppose there comes a scenario, when the application throws a scenario before the “Dispose” method is called. In such scenario, the application will never have a chance to reclaim the memory occupied by the unmanaged resources.

To avoid such scenario’s C# provides us a feature of using “Using” block in our code. When we use the using block, whatever happens inside the using block, the dispose method is always called. Lets understand this with the code implementation mentioned below

using (DisposeImplementation d = new DisposeImplementation())
{
 
}
Console.ReadLine();
GC.Collect();
Console.ReadLine();

Review that in the above code block we are using a class “DisposeImplementation” inside the using block.

We are not explicitly nullifying the object d, to indicate the garbage collector that its no longer needed. Also we are not explicitly calling the Dispose method to free up the unmanaged resources.

However as soon as the program will go out of scope of the using block the dispose method for the unmanaged code will be called and memory will be claimed back by the compiler.

Dynamics – Copy Static Marketing List Members into another Static Marketing List

Just wanted to highlight a feature in Dynamics , using which we can copy the members present in one static marketing list to another.

This can come handy when we want to execute a campaign on the same list of members present in a previous marketing list. Mentioned below are the steps we can use

a) Select the source “Static” marketing list and click on the ribbon button “Copy Marketing List”

Source Marketing List.PNG

b) A popup window should open up for selecting the target marketing list

target marketing list.PNG

c) Once user clicks on the “Add” button, review that a progress bar should open and once the processing is over, the members from the source marketing list should be copied to the target marketing list.

 

 

Dynamics – Tip for Managing Marketing Lists

Just wanted to share a strategy which can be used when we are managing marketing lists in Dynamics.

Problem Statement
In my last engagement, we were extensively using Click Dimensions for sending out emails on marketing lists. The marketing lists were based upon contacts and accounts which often got deactivated.

Even though the contacts were deactivated, as the records were still present in different marketing lists, emails were still going to them which was causing bad experience.

Approach

We can assume a two fold approach.

  • For Dynamic Marketing List – We should encourage users to always use the filter condition of “Active” records. This will ensure that deactivated contacts are automatically excluded from the marketing list.
  • For Static Marketing List – We can either

1. Configure configure system administrator to cleanse the marketing lists by using a similar view

Inactive Contacts

In the above view, we are filtering out inactive contacts, which are present in any  marketing list.

2. Or configure some custom logic to remove the deactivated contact from all the static marketing list.

 

Dynamics – Altering Primary Field During Entity Creation

Just wanted to share a tip in regards to the primary field of “Name” when we create a custom entity in Dynamics.

When an entity is created in Dynamics, by default a primary attribute of “prefix_name” is added to it. However in some cases we may not like the primary attribute to have the schema name “prefix_name”. For example in some cases , we may just like to have it as “id” or “external_identifier” to indicate a match with the legacy source of the data.

In such cases, when we are creating the entity, we can go to the tab “Primary Field” wherein we can modify the name of the primary field by altering its name. In the below screenshot, we are changing the Name field, by removing the word “name” from it and adding as per our preference.

Altered Name.png