0x80043b1d:This entity is already locked.Why?

Answered 0x80043b1d:This entity is already locked.Why?

  • 15. december 2007 02:56
     
     
    My codes:
                        ColumnSet cols = new ColumnSet();
                        cols.Attributes = new string[] { "new_package1_grossweight","new_package1_height",
                            "new_package1_length","new_package1_netweight",
                            "new_package1_packagequantity","new_package1_quantity",
                            "new_package1_unitvolume","new_package1_volume","new_package1_weight",
                            "new_package1_width","new_package2_grossweight","new_package2_height",
                            "new_package2_length","new_package2_netweight","new_package2_packagequantity",
                            "new_package2_quantity","new_package2_unitvolume","new_package2_volume",
                            "new_package2_weight","new_package2_width","new_packageuomcode",
                            "new_volumeuomcode","new_weightuomcode","salesorderdetailid",
                            "salesorderid","productid" };
                       
                        // Create the ConditionExpression.
                        ConditionExpression condition1 = new ConditionExpression();

                        condition1.AttributeName = "salesorderid";
                        condition1.Operator = ConditionOperator.Equal;
                        condition1.Values = new string[] { Purchaseorder1.new_salesorderid.Value.ToString() };

                        // Create the ConditionExpression.
                        ConditionExpression condition2 = new ConditionExpression();

                        condition2.AttributeName = "productid";
                        condition2.Operator = ConditionOperator.Equal;
                        condition2.Values = new string[] { Purchaseorderdetail1.new_productid.Value.ToString() };

                        // Create the FilterExpression.
                        FilterExpression filter1 = new FilterExpression();

                        // Set the properties of the FilterExpression.
                        filter1.FilterOperator = LogicalOperator.And;
                        filter1.Conditions = new ConditionExpression[] { condition1, condition2 };

                        // Create the QueryExpression.
                        QueryExpression query1 = new QueryExpression();

                        // Set the properties of the QueryExpression.
                        query1.EntityName = EntityName.salesorderdetail.ToString();
                        query1.ColumnSet = cols;
                        query1.Criteria = filter1;

                        // Retrieve the contacts.
                        Salesorderdetails = service.RetrieveMultiple(query1);

                        if (Salesorderdetails.BusinessEntities.GetLength(0) > 0)
                        {
                            Salesorderdetail1 = (salesorderdetail)Salesorderdetails.BusinessEntities[0];

                            if (Purchaseorderdetail1.new_package1_grossweight != null)
                            {
                                Salesorderdetail1.new_package1_grossweight = new CrmFloat();
                                Salesorderdetail1.new_package1_grossweight.Value = Purchaseorderdetail1.new_package1_grossweight.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_height != null)
                            {
                                Salesorderdetail1.new_package1_height = new CrmFloat();
                                Salesorderdetail1.new_package1_height.Value = Purchaseorderdetail1.new_package1_height.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_length != null)
                            {
                                Salesorderdetail1.new_package1_length = new CrmFloat();
                                Salesorderdetail1.new_package1_length.Value = Purchaseorderdetail1.new_package1_length.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_netweight != null)
                            {
                                Salesorderdetail1.new_package1_netweight = new CrmFloat();
                                Salesorderdetail1.new_package1_netweight.Value = Purchaseorderdetail1.new_package1_netweight.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_packagequantity != null)
                            {
                                Salesorderdetail1.new_package1_packagequantity = new CrmFloat();
                                Salesorderdetail1.new_package1_packagequantity.Value = Purchaseorderdetail1.new_package1_packagequantity.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_quantity != null)
                            {
                                Salesorderdetail1.new_package1_quantity = new CrmFloat();
                                Salesorderdetail1.new_package1_quantity.Value = Purchaseorderdetail1.new_package1_quantity.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_unitvolume != null)
                            {
                                Salesorderdetail1.new_package1_unitvolume = new CrmFloat();
                                Salesorderdetail1.new_package1_unitvolume.Value = Purchaseorderdetail1.new_package1_unitvolume.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_volume != null)
                            {
                                Salesorderdetail1.new_package1_volume = new CrmFloat();
                                Salesorderdetail1.new_package1_volume.Value = Purchaseorderdetail1.new_package1_volume.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_weight != null)
                            {
                                Salesorderdetail1.new_package1_weight = new CrmFloat();
                                Salesorderdetail1.new_package1_weight.Value = Purchaseorderdetail1.new_package1_weight.Value;
                            }
                            if (Purchaseorderdetail1.new_package1_width != null)
                            {
                                Salesorderdetail1.new_package1_width = new CrmFloat();
                                Salesorderdetail1.new_package1_width.Value = Purchaseorderdetail1.new_package1_width.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_grossweight != null)
                            {
                                Salesorderdetail1.new_package2_grossweight = new CrmFloat();
                                Salesorderdetail1.new_package2_grossweight.Value = Purchaseorderdetail1.new_package2_grossweight.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_height != null)
                            {
                                Salesorderdetail1.new_package2_height = new CrmFloat();
                                Salesorderdetail1.new_package2_height.Value = Purchaseorderdetail1.new_package2_height.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_length != null)
                            {
                                Salesorderdetail1.new_package2_length = new CrmFloat();
                                Salesorderdetail1.new_package2_length.Value = Purchaseorderdetail1.new_package2_length.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_netweight != null)
                            {
                                Salesorderdetail1.new_package2_netweight = new CrmFloat();
                                Salesorderdetail1.new_package2_netweight.Value = Purchaseorderdetail1.new_package2_netweight.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_packagequantity != null)
                            {
                                Salesorderdetail1.new_package2_packagequantity = new CrmFloat();
                                Salesorderdetail1.new_package2_packagequantity.Value = Purchaseorderdetail1.new_package2_packagequantity.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_quantity != null)
                            {
                                Salesorderdetail1.new_package2_quantity = new CrmFloat();
                                Salesorderdetail1.new_package2_quantity.Value = Purchaseorderdetail1.new_package2_quantity.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_unitvolume != null)
                            {
                                Salesorderdetail1.new_package2_unitvolume = new CrmFloat();
                                Salesorderdetail1.new_package2_unitvolume.Value = Purchaseorderdetail1.new_package2_unitvolume.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_volume != null)
                            {
                                Salesorderdetail1.new_package2_volume = new CrmFloat();
                                Salesorderdetail1.new_package2_volume.Value = Purchaseorderdetail1.new_package2_volume.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_weight != null)
                            {
                                Salesorderdetail1.new_package2_weight = new CrmFloat();
                                Salesorderdetail1.new_package2_weight.Value = Purchaseorderdetail1.new_package2_weight.Value;
                            }
                            if (Purchaseorderdetail1.new_package2_width != null)
                            {
                                Salesorderdetail1.new_package2_width = new CrmFloat();
                                Salesorderdetail1.new_package2_width.Value = Purchaseorderdetail1.new_package2_width.Value;
                            }
                            if (Purchaseorderdetail1.new_packageuomcode != null)
                            {
                                Salesorderdetail1.new_packageuomcode = new Picklist();
                                Salesorderdetail1.new_packageuomcode.Value = Purchaseorderdetail1.new_packageuomcode.Value;
                            }
                            if (Purchaseorderdetail1.new_volumeuomcode != null)
                            {
                                Salesorderdetail1.new_volumeuomcode = new Picklist();
                                Salesorderdetail1.new_volumeuomcode.Value = Purchaseorderdetail1.new_volumeuomcode.Value;
                            }
                            if (Purchaseorderdetail1.new_weightuomcode != null)
                            {
                                Salesorderdetail1.new_weightuomcode = new Picklist();
                                Salesorderdetail1.new_weightuomcode.Value = Purchaseorderdetail1.new_weightuomcode.Value;
                            }

                            service.Update(Salesorderdetail1);
                        }

Alle besvarelser

  • 16. december 2007 16:06
    Redaktør
     
     Svar
    It might be that the particular salesorder is in a state that does not allow modification. Can you modify it via the CRM user interface

     

  • 17. december 2007 00:19
     
     
    The StateCode of the SalesOrder is 0.The StatusCode is 1.And There are not StateCode or StatusCode
    in SalesOrderDetail. I have to modify it in codes!Help me pls!
  • 19. december 2007 01:42
     
     
    Yes! I have done it.Thank you very much!
  • 11. juni 2008 16:58
    Redaktør
     
     
    For reference, I found out a bit more about this error - it can occur if the productid property is set when passing the BusinessEntity to the Update method. See http://mscrmuk.blogspot.com/2008/06/this-entity-is-already-locked-message.html for more details