locked
"Unexpected exception from plug-in (Execute): CCP.ClientAuthorizationOnCreate: System.ArgumentException: The 'ccx_clientauthorization' entity must be in the default (null) or unchanged state." RRS feed

  • Question

  • Hi,

    I've created the custom button for creating a record. I've placed it on the form, On hit of the button it will create a record with all the data from the current record, including the subgrid records.  I have a plugin on that record on create message, such that it calculates the a particular field of all the records in its subgrid  and updates a field on the form.

    Normally if we create a record manually the pulgin working properly. when when the custom button is creating the record, it is throwing an error as,

    "Unexpected exception from plug-in (Execute): CCP.ClientAuthorizationOnCreate: System.ArgumentException: The 'ccx_clientauthorization' entity must be in the default (null) or unchanged state." 

                                      

    UpdateUnitsXml = UpdateUnitsXml.Replace("_Id", context.PrimaryEntityId.ToString());
                    EntityCollection TotalSum = service.RetrieveMultiple(new FetchExpression(UpdateUnitsXml));
                    foreach (Entity a in TotalSum.Entities)
                    {
                        int total = (Int32)((AliasedValue)a["total"]).Value;
                        targetEntity["ccx_units"] = total;
                        tracer.Trace("Contains Details" + total.ToString());
                        service.Update(targetEntity);


                    }

    Any Help..


    • Edited by vijay59 Wednesday, July 2, 2014 11:53 AM
    Wednesday, July 2, 2014 11:48 AM

Answers

  • Thanks Dynamotion for your help,

    Got it..

    Before updating, I'm retrieving the entire entity and then updating the retrieved entity.

    • Marked as answer by vijay59 Thursday, August 28, 2014 8:30 AM
    Saturday, July 5, 2014 9:30 AM

All replies