Show Image if field value equals…

ByRob Peledie

Show Image if field value equals…

Before I start, a massive shout out to Charles Osei .As part of the TDG team, we had a discussion, and his solution totally solved the requirement I had. Also another great example of how a collaborative group can work.

Had a requirement recently to show something a little more visual on a record form if a tick box was chosen…… something that would immediately show the user the status or conditions on a record.
In this example, were going to show Icons for Key Accounts and Sensitive Accounts at the top of the form if the corresponding fields are ticked.

Firstly, find your icons. For me I decided on a key for the Key Accounts, and an exclamation for the sensitive accounts, but I also added some text:

These need to be added to Dynamics as Web Resources.

Next add a section on your account form (I added a 3 column one) and add the two new icon web resources to it. Make sure you untick the box “Visible by Default” for each web resource.

You also need to add your radio buttons on the form – in my case one for Key Account and One for Sensitive.

Once these are all on, save and publish.

Next create a new web resource of type Script (JScript).

//Shows/hides keyaccount img webresouce based on a tickbox two option field

function alertpic (executionContext) 
    var formContext = executionContext.getFormContext();
    var keyaccount = formContext.getAttribute("uob_keyaccount").getValue();
    if (keyaccount === true) {
    else {

//Shows/hides sensacc img webresouce based on a tickbox two option field

function sensalert (executionContext) 
    var formContext = executionContext.getFormContext();
    var sensacc = formContext.getAttribute("uob_sensitiveaccount").getValue();
    if (sensacc === true) {
    else {

So the first variable sets the context (this will be passed as a parameter when you call the function).

The second variable is the tick box field.

Then depending on the value (True/False) it shows or hides the Icon.

Don’t forget to call the function from both Onload and Onchange (On the field)

The result:

ByRob Peledie

Using SSIS for Bulk Data Deletion in Dynamics 365

I had a situation recently that an instance (not one I managed I hasten to add!) had started to grow in storage, to the point that it was at nearly 200% capacity. I was asked to look at it. Turned out that Plugin Tracing had been switched on, and a plugin was throwing errors. Unfortunately there were now so many records in the Log file that it wouldn’t open (Usual generic unhelpful SQL Error).

Taking a quick look at organisation insights confirmed that this was consuming nearly 60gb of storage, and a quick record count (Using Record Counter in XrmToolBox) indication there was approaching 10,000,000 records.

Normally I would use the standard Bulk Delete option, however for a couple of reasons I didn’t think this was a viable option:

  1. It would take too long
  2. It kept falling over after 1000 deletes (probably due to the number of records, but I didn’t get to the bottom of it)

In the end I decided to go back to trusty old SSIS, and (again) the lovely KingswaySoft solution for Dynamics 365.

The steps are essentially:

  1. Create a CRM connection
  2. Retrieve what you want to delete (Using Dynamics Data Source Component)
  3. Delete

If you’ve used the SSIS Toolbox before, then you’ll know how to setup a connection.

To retrieve the data, I decided to go with FetchXML as I wanted to specify a date range, so the following was added to the Dynamics Source Data Flow:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="plugintracelog">
    <attribute name="plugintracelogid" />
    <filter type="and">
      <condition attribute="createdon" operator="on-or-before" value="2018-11-20" />

So the Fetch above would pull back any log files created before 20/11/2018.

Once this is done, connect the Source to the destination, and open up the Destination Module

Add your connection in Connection Manager.
In Action, choose Delete.
In Destination Entity, choose the Plugintracelog entity

I enabled multithread, and chose 32 threads.

Once that is all done, Save, Build and Run.

ByRob Peledie

JavaScript to show Form Notification

Just a quick one…..

Needed to show a notification on a form if an option set value = x

Used the following to get the text value, then show the Notification:



Add the function to an onload event, and the results:

ByRob Peledie

Anonymising Data in Dynamics 365 with SSIS

So I don’t want to get in to the whole GDPR discussion in this article, but with GDPR in mind, I think it’s important, and potentially reduces risk, to anonymise data in a non production environment.

Again, there are plenty of articles on whether it should be a process of anonymising or pseudonymisation, but for the purpose of this article, I am going to go through the steps of using SSIS for the purpose of Anonymising Dynamics 365 Data.

Firstly, a few assumptions…..

You have Visual Studio and SSIS setup. I’m personally using VS 2015 Pro Update 3, SSDT.

You will also need a couple of essential Dynamics tools from the lovely people at KingswaySoft

SSIS Integration Toolkit for Microsoft Dynamics 365

SSIS Productivity Pack

They provide a developer license model to get you started.

Once you have everything downloaded and setup, then you’re ready to go.

Create a new SSIS Project

In Connection Manager, create a new connection








Next, drag over the following components:

  • Dynamics CRM Source
  • Data Anonymizer
  • Dynamics CRM Destination








In the Dynamics Source Component, Enter the Connection you just created, the Entity (in this case Lead).







Click on the columns section, and choose which fields from Dynamics you want to anonymise…… In this case I chose things like FirstName, LastName, Email etc.







Connect the Dynamics CRM Source component to the Data Anonymiser component by dragging the connector.

Open the Data Anonymiser Component.






Here you will see the fields/columns you have decided to anonymise, and the option to choose the data type

So for example the email address will be anonymised with data of email type





Do this for all your fields/columns.

Once this is done, open the CRM Destination Component







Next click on the columns section and map the source to the destination







So to summarize….

  • CRM Connection
  • Choose Source entity and Fields
  • Choose Anonymise options
  • Set Destination Mapping

Once this is all done, save your solution and run it:









So in the instance above 274 Lead records were anonymised.

I hope you found this quick tutorial helpful.


Check Back Soon!

Thanks for checking out our new site!

Check back soon to see our updated blog posts!

I have decided to start again with the posts, as some of the old posts were for previous versions of Dynamics CRM/365 and not relevant.



365Knowledge Team