Update records without changing ‘Modified-By’ & ‘Modified-On’ in Dynamics 365

Hi Learners,

Using this approach we can update any field from a Record without actually impacting Modified By & Modified On values.

Please Note: It is not best practice to suppress Modified By & Modified On auto calculation by Dynamics, but this approach helps in scenarios like below

  1. Scenario -1 : We introduced a new filed and want to set a default value for all the existing records, but don’t want to touch Modified By for reporting / downstream integration purposes.
  2. Scenario – 2 : We missed updating some information during data migration and want to update the information later without Modified On/Modified By being updated.


We will be using Pre-Operation plugin to set “modifiedon” & “modifiedby” to the existing values (fetched from Pre-Image). Same Approach can be for overriding Modified By / Modified On / Created By / Created On with some custom values.

Step-By-Step process:

1) For the Entity you want to use (Account for this example), Create a new boolean field called “Override Modified On” (new_overridemodifiedon), set default value as NO.

2) Create a new Plugin with below code.

public void Execute(IServiceProvider serviceProvider)
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
Entity targetEntity = (Entity)context.InputParameters["Target"];
Entity preImage = context.PreEntityImages.Contains("PreImage") ? (Entity)context.PreEntityImages["PreImage"] : null;
bool _override = targetEntity.Contains("new_overridemodifiedon") ? (bool)targetEntity.Contains("new_overridemodifiedon") : false;    
if (preImage != null && _override)
        targetEntity["modifiedon"] = preImage["modifiedon"];
        targetEntity["modifiedby"] = preImage["modifiedby"];
        //Set Override Modified On to false for future use.
        targetEntity["new_overridemodifiedon"] = false;

3) Register the plugin and add step as shown below.

Message = Update;
Primary Entity = <<Entity you want to use >>
Filtering Attribute = new_overridemodifiedon (created in 1st step)
Pipeline Stage = Pre-Operation.

4) Register an Image under the step as below

Image Type = Pre Image
Name = PreImage
Parameters = modifiedby, modifedon

5) Now whenever you want to Update something without “Modified On” being touched, Check the checkbox “Override Modified On” along with your other changes.

The changes are tracked under Audit History.

But you can observe that, even after the fields are updated, Modified On doesn’t change and retains its old value.

6)It works even if you are making updates through SDK / any other integration platform. You just need to set “Override Modified On” = true, along with the update that you perform.



1) https://community.dynamics.com/365/b/learncrminfingertips/posts/preserve-or-ovverride-createdon-createdby-modifiedon-modifiedby-fields

Custom Lookup Control with multi select and with multiple entities

Hi Learners,

Here is the supported / documented way of creating a custom Lookup input control using Client Side Scripting (JavaScript). We can use this to capture multiple records across multiple entities (Just like Party List control in Email Activities). It can be called from form events / HTML web resource to prompt input from users using Lookup control.

JavaScript Sample Code:

When invoked, this function prompts a lookup control as a model dialog (aligned to the right, like Quick Create Form)

Search will be performed across the entities specified in entityTypes property (Accounts, Leads and Contacts in this Sample)

We can select multiple records from the results

When we click on “Add“, the selected entity reference objects are passed to the Success Call back function as below. We can use this information further in our JavaScript Code based on the requirement.

lookupOptions object defines the look and behavior of the lookup control. It has got all the properties that an OOB lookup control on the form would have, like view selection control, disabling most recently used items etc.

Below is the list of properties available. More information available HERE

Property NameTypeRequiredDescription
allowMultiSelectBooleanNoIndicates whether the lookup allows more than one item to be selected.
defaultEntityTypeStringNoThe default entity type to use.
defaultViewIdStringNoThe default view to use.
disableMruBooleanNoDecides whether to display the most recently used(MRU) item.
entityTypesArrayYesThe entity types to display.
filtersArray of objectsNoUsed to filter the results. Each object in the array contains the following attributes:
searchTextStringNoIndicates the default search term for the lookup control.
showBarcodeScannerBooleanNoIndicates whether the lookup control should show the barcode scanner in mobile clients.
viewIdsArrayNoThe views to be available in the view picker. Only system views are supported.


1) https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/lookupobjects