mbreton
mbreton

Reputation: 18

Trigger plugin event on entity save

In Dynamics CRM 2011, I have an entity (Quote).

My problem, it's impossible to trigger an event during form saving in order to complete some actions. (Work on a new entity 'Create', but 'Update' with an existing entity doesn't work)

(ie: Send email based on calculs).

I tried with all type of "Message" and "pipeline stage" but nothing is triggered.

Some ideas to help me ?

Edit:

I throw an exception to know if is triggered, like this

  protected void ExecutePreDevisUpdate(LocalPluginContext localContext)
    {
        if (localContext == null)
        {
            throw new ArgumentNullException("localContext");
        }
        throw new Exception("prédevis");
        // TODO: Implement your custom Plug-in business logic.
    }

Upvotes: 0

Views: 1082

Answers (2)

user2295317
user2295317

Reputation:

Just like @Nicknow said, you should download the crm 2011 SDK and use the pluginregistrationtool.exe. You don't have to run it on the crm server if that helps.

That being said, without source code or an error message, I would assume that the plugin's FilteringAttributes aren't set properly.

When you register the plugin to update, you need to specify the entity fields being updated that it must run on. The plugin runs only when these fields are updated.

You can view these configuration settings in multiple ways, but the Plugin Registration Tool is a sure thing. Here is a walkthrough in msdn with it: http://msdn.microsoft.com/en-us/library/gg309580.aspx

Hope this helps.

Upvotes: 0

SteveG
SteveG

Reputation: 21

Have you tried attaching to the w3wp.exe service on the server and putting a breakpoint at the start of your execute method?

You will need to install the remote debugger on your server.

Upvotes: 0

Related Questions