Add the Insights tab to Lead and Contact forms in Dynamics 365 Marketing
The ‘Insights’ tab for Leads & Contacts in Dynamics 365 Marketing has had a bit of a facelift so that you can see insights for both real time and outbound marketing. But if you are not using the out of the box forms for Dynamics 365 Marketing you probably wont be able to enjoy this smorgasbord of analytics - wah! The good news is it can be added to your custom forms, the not so good news is that you have to do it by editing the form xml and the consolidation is that I wrote a step by step guide on how to do it.
More info about the insights tab can be found here and also in a recent post from Megan V. Walker too!
For obvious reasons - do this in a development environment, test it and check it before sharing your insightful magic with the rest of your users!
Export the form
Create a new solution into which we will add the custom form that you want to add the insights tab on to. Before exporting, edit the custom form with a tab clearly labelled to show that this is where the insights tab should be, we can change this later but having an obvious name will help you dig around in the XML a bit more easily in the next step. See below ‘I Need Insights’ and ‘Insights here please’ as an example. Ensure you save and publish your changes.
Export as an unmanaged solution.
Edit the Form XML
Download the solution you just exported and in your download file explorer, right click and ‘Extract All…’. Open the customizations.xml file in whatever plain text program you use (I use visual studio code which beats notepad hands down, but entirely optional).
In the customizations.xml file search for the tab that you want to add the insights into (that handy tab name you added earlier becomes very useful now! Replace everything inside the <tab> and </tab> tags with the below Tab snippet, note its tab not tabs.
<tab name="{f94785d7-45b5-4625-99d2-18ded86c7997}" id="{ce542e0b-8106-42b0-9888-f197e943e1d3}" visible="true" IsUserDefined="0" locklevel="0" showlabel="true" expanded="true" contenttype="expandAvailableSpace" labelid="{3cc00f2f-b9fe-4e50-a2a9-bfe5ee171632}"> <labels> <label description="Hello Insights" languagecode="1033" /> </labels> <columns> <column width="100%"> <sections> <section name="insights_section_new" showlabel="false" showbar="false" locklevel="0" id="{9f2b5989-d7c2-4a6b-b04b-131a2ad179e4}" IsUserDefined="0" layout="varwidth" columns="1" labelwidth="115" celllabelalignment="Left" celllabelposition="Left" labelid="{c3c6d5c3-095a-452b-a3b4-2f729780119a}"> <labels> <label description="Insights" languagecode="1033" /> </labels> <rows> <row> <cell id="{3749ec0d-f4dc-42ef-8a6f-bf67ef297f7f}" showlabel="false" locklevel="0" labelid="{66e9d3f2-ccdf-409f-b463-0afa2d7bd488}"> <labels> <label description="Insights" languagecode="1033" /> </labels> <control id="msdynmkt-contact-insights-tab-control" classid="{F9A8A302-114E-466A-B582-6771B2AE0D92}" disabled="false" uniqueid="{786AA73C-8052-4C62-A622-B32D36CB8FD4}" isunbound="true" /> </cell> </row> </rows> </section> </sections> </column> </columns> </tab>
Then find the tag for </controlDescriptions> and just above that, add this Control Description snippet
<controlDescription forControl="{84D81CD8-444F-4DE3-B523-0896194D577F}"> <customControl formFactor="0" name="CxpOrchestrationAnalytics.InsightsBannerControl.InsightsBannerControl"> <parameters /> </customControl> <customControl formFactor="1" name="CxpOrchestrationAnalytics.InsightsBannerControl.InsightsBannerControl"> <parameters /> </customControl> <customControl formFactor="2" name="CxpOrchestrationAnalytics.InsightsBannerControl.InsightsBannerControl"> <parameters /> </customControl> </controlDescription> <controlDescription forControl="{786AA73C-8052-4C62-A622-B32D36CB8FD4}"> <customControl formFactor="0" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration static="true" type="SingleLine.Text">ContactInsights</configuration> </parameters> </customControl> <customControl formFactor="1" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration static="true" type="SingleLine.Text">ContactInsights</configuration> </parameters> </customControl> <customControl formFactor="2" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration static="true" type="SingleLine.Text">ContactInsights</configuration> </parameters> </customControl> </controlDescription>
Import your changes
Save your changes from above then navigate into your extracted folder from earlier. Select the three files (customizations,solution,[Content_Types]), right click and ‘Compress to zip file’. The name of the folder doesn’t really matter so call it something useful e.g. ‘Insightful Stuff’.
Return to the Power Apps maker studio and import your solution, ensuring you select the new zipped folder you created.
Publish your changes. You can now open the form from the maker studio to edit your tab/section labels accordingly, publish and prepare to be insightfully insighted!
Leads have insights too you know!
In the wonderful word of real-time marketing we can now market direct to leads without a parent contact needing to exist, so of course we need to add the tab to the lead form also! The steps are exactly the same as above, but this time you are exporting a custom lead form (with your insights tab added as a placeholder). Replace the insights <tab> </tab> tags with this code snippet.
<tab name="rtm_insights" id="83f6ba89-69eb-4e82-8330-465f8e63aeca" IsUserDefined="0" locklevel="0" showlabel="true" visible="true" contenttype="singleComponent" labelid="{096c7ab5-d633-4a3d-83fd-20bb6e082d83}"> <labels> <label description="How Insightful" languagecode="1033" /> </labels> <columns> <column width="100%"> <sections> <section name="tab_7_section_1" id="463a7e9f-84bc-4672-adc5-1d1778301a03" IsUserDefined="0" locklevel="0" showlabel="true" showbar="false" layout="varwidth" celllabelalignment="Left" celllabelposition="Left" columns="1" labelwidth="115" labelid="{03e78390-d5da-433e-b7a4-7bb4fac11217}"> <labels> <label description="Insights" languagecode="1033" /> </labels> <rows> <row> <cell locklevel="0" id="{e2b26c8e-fe2d-4ec0-9bae-84e6cad8ba83}" colspan="1" rowspan="1" showlabel="false" labelid="{5e56c8f7-c5f6-47e6-9e83-737eb14c417a}"> <labels> <label description="Insights" languagecode="1033" /> </labels> <control id="cc_1680511450308" classid="{F9A8A302-114E-466A-B582-6771B2AE0D92}" uniqueid="{85079EAA-A51B-43DD-9967-752C6C9F2742}" isunbound="true" /> </cell> </row> </rows> </section> </sections> </column> </columns> </tab>
Then find the tag for </controlDescriptions> and just above that, add this Control Description snippet
<controlDescription forControl="{85079EAA-A51B-43DD-9967-752C6C9F2742}"> <customControl formFactor="0" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration type="SingleLine.Text" static="true">LeadInsights</configuration> <parentAccountId type="Lookup.Simple">parentaccountid</parentAccountId> <parentContactId type="Lookup.Simple">parentcontactid</parentContactId> </parameters> </customControl> <customControl formFactor="2" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration type="SingleLine.Text" static="true">LeadInsights</configuration> <parentAccountId type="Lookup.Simple">parentaccountid</parentAccountId> <parentContactId type="Lookup.Simple">parentcontactid</parentContactId> </parameters> </customControl> <customControl formFactor="1" name="MsdynmktControls.TabbableInsightsControl.TabbableInsightsControl"> <parameters> <configuration type="SingleLine.Text" static="true">LeadInsights</configuration> <parentAccountId type="Lookup.Simple">parentaccountid</parentAccountId> <parentContactId type="Lookup.Simple">parentcontactid</parentContactId> </parameters> </customControl> </controlDescription>
Import - Publish - Enjoy. Now get back to work and go generate some insights!