Determine if Create or Update in CRM 2011 Plugin

30 Nov
2012

Sometimes you will need to set a plugin to have a step to fire on the creation of a record. You may also want the same plugin to handle the updating of the same entity type. So in order to determine what mode you are in, you can use the following code for the create mode.


if (context.MessageName.ToUpper() == "CREATE"){
//CODE GOES HERE
}

and the following code for the update mode.


if (context.MessageName.ToUpper() == "UPDATE"){
//CODE GOES HERE
}

Hope this helps.

Leave a Reply