web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

ICrmService.Update() Throws an error

(0) ShareShare
ReportReport
Posted on by 115

Hey guys,

I have been having this problem with a plugin for a few days now. It worked at one point, then I re-registered it and it stopped. When I try and run ICrmService.Update on an entity I have edited, it throws this error:

Server was unable to process request.

Stack Trace:

Microsoft.Crm.Extensibility.SdkTypeProxyCrmServiceWrapper.InternalInvoke(MethodInfo methodInfo, Object[] parameters) at

Microsoft.Crm.Extensibility.SdkTypeProxyCrmServiceWrapper.Update(BusinessEntity entity) at

Plugin.Execute(IPluginExecutionContext context)

 This is really quite annoying considering the same code was working just hours before. I also debugged to the point of calling Update and all of the proper values are there and everything seems to be of the correct type. Thanks.

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: ICrmService.Update() Throws an error

     Try to use try/catch mechanisms for exception handling:

    try

    {

    //update here

    }

    catch(SoapException ex)

    {

    throw new Exception(ex.Detail.InnerText, ex);

    }

     

    This will give you detailed exception.

  • RyanGraham Profile Picture
    115 on at
    Re: Re: ICrmService.Update() Throws an error

    That seems to give me even less infomation:

    0x80040265 Server was unable to process request. Platform

    Whatever that means.

     I've been doing a little digging and it seems that the error could mean that the entity that I am passing into Update is missing required information. I don't think I am. I am retrieving an entity that already exists, changing a value, then calling update on it. It contains its primarykey and all that. The entity also doesn't have any required fields at all, so it seems weird to think I don't have something required.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: Re: ICrmService.Update() Throws an error

     Can you provide the code you use?

  • RyanGraham Profile Picture
    115 on at
    Re: Re: Re: Re: ICrmService.Update() Throws an error
    ICrmService service = context.CreateCrmService(true);

    IMetadataService metadataService = context.CreateMetadataService(false);

    DynamicEntity agency = (DynamicEntity)context.PostEntityImages.Properties["PostImage"];

    //DynamicEntity changedAgency = (DynamicEntity)context.InputParameters.Properties["Target"];

    // Declare the target to retrieve and set up the request object

    TargetRetrieveDynamic raTarget = new TargetRetrieveDynamic();

    // Give agencyTarget the information it needs to find the agency needed

    Lookup lookupData = (Lookup)agency["custom_regardingid"];

    raTarget.EntityId = lookupData.Value;

    raTarget.EntityName =
    "custom_restrictedagencydata";

    // Retrieve the contact information that is being deleted

    DynamicEntity restrictedAgencyData = PluginUtilities.RetrieveDynamicEntity(raTarget, ref service);

     

    string name = String.Concat("Restricted Data for: ", agency["new_code"].ToString());

    restrictedAgencyData.Properties.Remove("custom_name");

    restrictedAgencyData.Properties.Add(new StringProperty("custom_name", name));

    try

    {

    service.Update(RestrictedAgencyData);

    }

    catch (SoapException e)

    {

    PluginUtilities.Alert(e.Detail.InnerText);

    }

     

    Like I said before, all of the data gets changed as it should. The new restrictedagencydata field is good. The error comes from Update.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: Re: Re: Re: ICrmService.Update() Throws an error

     Your code looks good.

    Is there any possibility that Update of this entity triggers execution of other plugin? I had similar errors once.

  • RyanGraham Profile Picture
    115 on at
    Re: Re: Re: Re: Re: Re: ICrmService.Update() Throws an error

    It should trigger two other plugins. A Log for the agency and a log for its restricted data. Each noting the change in field. Neither one of which conflicted with it when I had it working.

  • RyanGraham Profile Picture
    115 on at
    Re: Re: Re: Re: Re: Re: ICrmService.Update() Throws an error

    I disabled both of those plugins and tried running it again. Apparently they were causing the error. Thank you for pointing me in that direction!

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: Re: Re: Re: Re: Re: ICrmService.Update() Throws an error

     All I can suggest - is to debug your plugins. I may be wrong but it seems that error occurs in one of "two other plugins". It is not usual behaviour that Update method throws an Exception.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans