crm - Error Updating Dynamic Entity When Setting Property Value of Type PickList -
i've added custom attribute ("custom_contacttype") contact entity. attribute of type picklist comprised of 7 values. i'm developing using advanced developer extensions microsoft dynamics crm against crm 4.0. after set value attribute , call savechanges() "object reference not set instance of object." error. i've been battling 1 while. doing wrong? below code:
var crm = new crmdatacontext(context.connection); var savecontact = crm.getentities("contact").where(p => p.getpropertyvalue<guid> ("contactid") == contact.id.value).single(); savecontact.setpropertyvalue("custom_contacttype", 2, typeof(picklist)); crm.updateobject(savecontact); crm.savechanges();
trace log crm server: [2011-07-01 16:39:33.7] process: w3wp |organization:f827deb3-c6cc-df11-bc07-005056887b79 |thread: 8 |category: platform.sdk |user: 822138f1-c574-e011-9dca-005056887b79 |level: error | pluginstep.execute @ pluginstep.execute(pipelineexecutioncontext context) @ pipeline.execute(pipelineexecutioncontext context) @ messageprocessor.execute(pipelineexecutioncontext context) @ internalmessagedispatcher.execute(pipelineexecutioncontext context) @ externalmessagedispatcher.execute(string messagename, int32 primaryobjecttypecode, int32 secondaryobjecttypecode, propertybag fields, correlationtoken correlationtoken, callerorigintoken origintoken, userauth userauth, guid callerid) @ crmserviceinternal.update(string namespacename, businessentitybase entity, correlationtoken correlationtoken, callerorigintoken origintoken, userauth userauth, guid callerid) @ crmservice.update(businessentity entity) @ runtimemethodhandle._invokemethodfast(object target, object[] arguments, signaturestruct& sig, methodattributes methodattributes, runtimetypehandle typeowner) @ runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture, boolean skipvisibilitychecks) @ runtimemethodinfo.invoke(object obj, bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ logicalmethodinfo.invoke(object target, object[] values) @ webservicehandler.invoke() @ webservicehandler.coreprocessrequest() @ syncsessionlesshandler.processrequest(httpcontext context) @ callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) @ applicationstepmanager.resumesteps(exception error) @ httpapplication.system.web.ihttpasynchandler.beginprocessrequest(httpcontext context, asynccallback cb, object extradata) @ httpruntime.processrequestinternal(httpworkerrequest wr) @ httpruntime.processrequestnodemand(httpworkerrequest wr) @ isapiruntime.processrequest(intptr ecb, int32 iwrtype)
web service plug-in failed in sdkmessageprocessingstepid: {27df4121-19bc-df11-a90e-005056887b79}; entityname: contact; stage: 10; messagename: update; assemblyname: accesscrm.changelogcontactdata, accesscrm, version=1.0.0.0, culture=neutral, publickeytoken=a030c130976783ab; classname: accesscrm.changelogcontactdata; exception: unhandled exception: system.nullreferenceexception: object reference not set instance of object. @ accesscrm.pluginutilities.getstringvaluefromproperty(property p) @ accesscrm.changelogcontactdata.execute(ipluginexecutioncontext context) @ microsoft.crm.extensibility.pluginstep.execute(pipelineexecutioncontext context) . [2011-07-01 16:39:33.7] process: w3wp |organization:f827deb3-c6cc-df11-bc07-005056887b79 |thread: 8 |category: platform.sdk |user: 822138f1-c574-e011-9dca-005056887b79 |level: error | pluginexecutionexceptionhandler.handle @ pluginexecutionexceptionhandler.handle(stream from, stream to, exception exception) @ compositesoapextensionexceptionhandler.handle(stream to, stream from, exception exception) @ crmauthenticationsoapextensionbase.processmessage(soapmessage message) @ soapmessage.runextensions(soapextension[] extensions, boolean throwonexception) @ soapserverprotocol.writeexception(exception e, stream outputstream) @ webservicehandler.writeexception(exception e) @ webservicehandler.invoke() @ webservicehandler.coreprocessrequest() @ syncsessionlesshandler.processrequest(httpcontext context) @ callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) @ applicationstepmanager.resumesteps(exception error) @ httpapplication.system.web.ihttpasynchandler.beginprocessrequest(httpcontext context, asynccallback cb, object extradata) @ httpruntime.processrequestinternal(httpworkerrequest wr) @ httpruntime.processrequestnodemand(httpworkerrequest wr) @ isapiruntime.processrequest(intptr ecb, int32 iwrtype) crmsoapextension detected invalidpluginexecutionexception: system.web.services.protocols.soapexception: server unable process request. ---> microsoft.crm.sdk.invalidpluginexecutionexception: object reference not set instance of object. ---> system.nullreferenceexception: object reference not set instance of object. @ accesscrm.pluginutilities.getstringvaluefromproperty(property p) @ accesscrm.changelogcontactdata.execute(ipluginexecutioncontext context) @ microsoft.crm.extensibility.pluginstep.execute(pipelineexecutioncontext context) --- end of inner exception stack trace --- @ microsoft.crm.extensibility.pluginstep.execute(pipelineexecutioncontext context) @ microsoft.crm.extensibility.pipeline.execute(pipelineexecutioncontext context) @ microsoft.crm.extensibility.messageprocessor.execute(pipelineexecutioncontext context) @ microsoft.crm.extensibility.internalmessagedispatcher.execute(pipelineexecutioncontext context) @ microsoft.crm.extensibility.externalmessagedispatcher.execute(string messagename, int32 primaryobjecttypecode, int32 secondaryobjecttypecode, propertybag fields, correlationtoken correlationtoken, callerorigintoken origintoken, userauth userauth, guid callerid) @ microsoft.crm.sdk.crmserviceinternal.update(string namespacename, businessentitybase entity, correlationtoken correlationtoken, callerorigintoken origintoken, userauth userauth, guid callerid) @ microsoft.crm.sdk.crm2007.crmservice.update(businessentity entity) --- end of inner exception stack trace ---
looking @ stack trace, error being thrown in plugin, not in code have pasted above. @ line in particular:
unhandled exception: system.nullreferenceexception: object reference not set instance of object. @ accesscrm.pluginutilities.getstringvaluefromproperty(property p) @ accesscrm.changelogcontactdata.execute(ipluginexecutioncontext context)
you'd need post code plugin have look.
alternatively use remote debugging debug yourself.
Comments
Post a Comment