Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Plugin - Post Operation error

$
0
0

HI,

I've registered a plugin on create message post operation.

I want to check for an attribute value just after creation of the record.

my plugin code is something like this:

 if (context.InputParameters.Contains("Target") &&
            context.InputParameters["Target"] is Entity)
            {
                // Obtain the target entity from the input parmameters.
                Entity entity = (Entity)context.InputParameters["Target"];

                if (context.PrimaryEntityName == "new_case")
                {
                    string status = string.Empty;
                    status = (string)entity.Attributes["new_status"];

                    if (status=="Transfer")
                    {
                        try
                        {
// some code here
   }
  }
 }
}


But when I create the record, I get 'The given key is not present in the dictionary' error.

I registered it on post operation, then there should be the value in it right? What am I doing wrong? Someone please guide me.

Thanks.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>