locked
Differences in plugin functionality on PostOpportunityWin between CRM 2011 and CRM 2013 RRS feed

  • Question

  • Hello,

    I have developed a plugin for CRM 2011 (using the CRM Developer Toolkit for Visual Studio 2012) that executes when an opportunity is closed as "Won." The plugin itself is very simple, I retrieve the OpportunityClose object from the InputParameters, and then pull the opportunityid attribute from that entity and pass it off to a web service. For Dynamics CRM 2011, this works fine- for Dynamics CRM 2013, the Id property on the OpportunityClose entity is an empty GUID.

    Sample code:

            protected void ExecutePostOpportunityWin(LocalPluginContext localContext)
            {
                if (localContext == null)
                {
                    throw new ArgumentNullException("localContext");
                }
    
                var oc = (Entity)localContext.PluginExecutionContext.InputParameters["OpportunityClose"];
                var opportunityId = ((EntityReference)oc.Attributes["opportunityid"]).Id;
                var additionalProperties = new Dictionary<string, object>()
                {
                    { "OpportunityCloseId", oc.Id }
                };
                
                // (snip) code to pass values to web service
            }

    Following the above code, as I step through in a debugger... when integrating with Dynamics CRM 2013, oc.Id is an empty GUID. In Dynamics CRM 2011, it is the correct value. I've done a number of searches and read a lot of documentation, but nothing I've found indicates that this is either a bug or an intentional change.

    Thanks in advance,

    Steve



    Monday, March 17, 2014 8:59 PM

All replies