Search

Wednesday, February 10, 2010

createdon vs overriddencreatedon

When we create a record in CRM, the created on field always points at the date the record is created. Of course we could go into the database and update the date by using a SQL script. But then again, “it's not supported".

And what we found from CRM SDK. createdon is a Read-only field and can’t be updated and created.

Platform required : No
Application requirement level : Read-only
Valid for create : No
Valid for retrieve : Yes
Valid for update : No

After googled it around, I found a something interesting…


In CRM 4.0, the CRM development team has silently introduced a new feature – overriddencreatedon field. While creating a record, we can set the attribute overriddencreatedon field. The value of this field will be used to set the record's created on attribute.

account agent = new account();
 
agent.new_agentname = "pq";
agent.overriddencreatedon = CreateCrmDateTime(new DateTime(2004, 10, 19));
 
services.Create(agent);

















A small feature makes big differences.

No comments:

Post a Comment