Hello All,
I have custom entity .
i am calling a sdk update method to update the entity record but getting the object reference error.
serviceproxy.update(custom entity instance);
can anybody let me know what could this error be.
*This post is locked for comments
Hello Pawell,
Below is the stacktrace that i am getting after the .Update method call.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Update(Entity entity)
at Microsoft.Xrm.Client.Services.OrganizationService.<>c__DisplayClass13.<Update>b__12(IOrganizationService s)
at Microsoft.Xrm.Client.Services.OrganizationService.InnerOrganizationService.UsingService(Action`1 action)
at Microsoft.Xrm.Client.Services.OrganizationService.Update(Entity entity)
at Microsoft.Xrm.Client.Services.CachedOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Client.CrmOrganizationServiceContext.Update(Entity entity)
at McGladrey.XrmConsoles.FormServiceDocumentUpdate.Program.UpdateEntity(Entity entity)
Can anyone try to answer this : community.dynamics.com/.../220435
Are you trying to assign any option set value.??
If yes,check your opinion set value limit once.
Hi,
This code is not helpful at all because we are looking for error in your specific code and you are pasting general idea for us, how then we can help you?
Paste full stacktrace of the exception (I guess stacktrace are not restricted by your company...), currently we don't know if error is on your code side or is thrown by CRM because something else (for example a plugin on Update).
using (OrganizationServiceProxy objref=OrganizationServiceProxy())
{
Entity location =new Entity(new_CustomEntity)
location.Attribute["x"]=some value;
location.Attribute["y"]=some value;
location.Attribute["z"]=some value;
location.Attribute["p"]=some value;
location.Attribute["q"]=some value;
location.Attribute["r"]=some value;
objref.Update(location) // this line giving error . as object reference not set to an instance of an object.
}
I cannot put my code as i have restriction .
So above is the high level idea which i have put in the code format.
don't go each and every syntax missing or anything else as it is high level put forth.
Now suggest me what is going to be wrong.
Post your code snippet, that will make lot easier for Forum members to suggest solutions
Hi,
You need to paste full code here, otherwise it's hard to help. Also are there any plugin on Update of this custom entity?
Can you please tell me that, exactly in which line you are getting error? And paste here your update record code.
Hello Shivaram,
I am getting the id in the entity , but i need to know is there any impact of the related entities as well??
Hello Alagu,
Both the things are not null.
Both are instantiated.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156