C# Code · Dynamics Plugins

Dynamics CRM 365 overridecreatedon field unknown facts

I just tested the code to replace the field createdOn in two different ways:

  1. With a plugin with step on create pre-operation, and the createdOn was not overridden.
  2. Then I tried the same code but using an external application (console application) and this time the createdOn was overridden by the date defined on overriddencreatedOn.

Actually, this makes sense because this features is used to maintain historical data after records have been imported to CRM (maintain the createdOn date of the records imported).

In addition to above notes on syntax, be aware that you need a security privilege to override createdon or createdby (on the Business Management tab of Security Role). Make sure the user running your code (or whom it is impersonating) has this privilege.

Console Code snippet

Entity objLead=new Entity(“lead”);//replace lead with your entity

nameobjLead[“firstname”]=”Testoverrideon”;

objLead[“overridecreatedon”]=Datetime.now;//Replace this with whatever data you want to update

Guid recordId=service.create(objLead);

Hope you find thie helpful!

2 thoughts on “Dynamics CRM 365 overridecreatedon field unknown facts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s