Sales Order - Ready To Process

I am working on one customization and we need to set the Ready To Process checkbox true on the Sales Order Entry screen when we received payment from the customer. I have created a Method Directive on CashRec.UpdateMaster and using the below code but system is throwing error “Row Modified by Another User”

Erp.Contracts.SalesOrderSvcContract SOsvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db);
using (var txscope = IceDataContext.CreateDefaultTransactionScope())
{
var OrderDs = SOsvc.GetByID(ttCashHed_Row.OrderNum);

                 if(OrderDs.OrderHed[0].UDField<bool>("DraftOrder_c"))
                 {  
                    OrderDs.OrderHed[0].SetUDField<bool>("DraftOrder_c", false);
                    OrderDs.OrderHed[0].SetUDField<bool>("CheckBox05", true);
                    OrderDs.OrderHed[0].RowMod  = "U"; 
                    SOsvc.Update(ref OrderDs); 
		
		bool lCheckForOrderChangedMsg = true;
              	bool lcheckForResponse = true;
              	string cTableName = "OrderHed";
              	int iCustNum = OrderDs.OrderHed[0].BTCustNum;
              	int iOrderNum = OrderDs.OrderHed[0].OrderNum;
              	bool lweLicensed = false;
              	bool outbool;
              	string outstring;                  
              	SOsvc.MasterUpdate(lCheckForOrderChangedMsg,lcheckForResponse, cTableName, iCustNum, iOrderNum, lweLicensed, out outbool,out outstring,out outstring,out outstring,out outstring,out outstring,out outstring,out outstring, out outstring, ref OrderDs);                 
  
                                     
                 }                     
                 txscope.Complete();
            }

Anyone can suggest how to resolve this.

1 Like

You may have to refresh the dataset as a final step.

This post should help

1 Like

This shouldn’t be what’s causing your “Row modified by another user” error, but umm… shouldn’t you be checking Ready To Process to calculate taxes before taking payment from the customer?

I would imagine the “Row Modified by another User” error is because you’re calling Update AND MasterUpdate in the same Transaction scope. Is there a particular reason you’re doing both? Or why you’re not using updateExt?

Also, I could be missing it, but I don’t see anywhere that you’re actually changing the value of ReadyForProcessing. Only Checkbox05 and DraftOrder_c.