Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 51311

Get out of the habit of using new ColumnSet(true); in your Dynamics CRM .NET Code

$
0
0
Do you use new ColumnSet(true); to quickly pull all of the entity columns in one swoop.  Many times, unless a plugin gets run too often there is little impact on the system and it can seem innocent enough.  I have definitely been guilty in the past of this one myself and I want to share one situation where it can bite you in the rear.

So you are new to a specific CRM installation and you have been tasked to write a plugin to perform some task.  You need to update some fields in the account entity based on the data that's already on the entity.  You decide to use new ColumnSet(true); instead of pulling just the attributes you explicitly need to perform the intended function of the plugin, because heck, as developers we can be lazy sometimes and it takes longer to write out all the schema names you need for the specific attributes.

What you don't know is that the company's GP partner has an integration to GP that runs when a specific field on the account is updated.  Even if you don't change the value of that field, the system still sees it as an update because that attribute is now included in the entity you just updated... because you were lazy.

And you can replace the word "you" in that last paragraph with "I" because that's what I just did today. Whoops!

- Happy Thursday!

Viewing all articles
Browse latest Browse all 51311

Trending Articles