Code Library

Message: lose – (Primary Entity: Opportunity)


This code example demonstrates code that fires on the lose message of an Opportunity entity. The code checks to see if an attribute in the current opportunity record is not null, if the attribute is null, an exception is thrown.

Plug-in is registered on the win message.


No additional information.

No additional information.


Using the debugger and attaching to the wpw3.exe on the CRM server allows us to debug the plug-in at runtime. This allows us to monitor the InputParameters to discover the current entity that fired the plug-in (OpportunityClose). The values from the InputParameters (Keys[0]) provides the reference to the originating Opportunity record.

Opportunity Fire on Lose

The results view in the debugger illustrates that the GUID, LogicalName is provided for opportunityid.

Opportunity Results