Attempting to Restrict Access to The Same Sales Order

Hello.
I am attempting to restrict access so two users cannot access the same Sales Order at the same time.
To accomplish this, I set OrderHed CheckBox20 to true within the GetByID Method Directive if it is false upon retrieval. If it is false, I inform the user that the record is currently being edited by another user. Unfortunately, there doesn’t seem to be any practical means for clearing CheckBox20 once the user exits the record.
Within the screen customization, I watch oTrans_ordAdapter_AfterAdapterMethod for “ClearList” as this seems to be the right place to call my ClearOrderLock() method.
My difficulty is that I no longer have access to the OrderHed epiDataView, so I need to know if there is a way for me to do a blunt force update of OrderHed CheckBox20 using the OrderNum textbox value, which as luck would have it is still aware of the order number. I thought perhaps I could do it using one these two methods, but so far, CheckBox20 is not being set back to false:

private void ClearOrderLock()
{
	int orderNum = Convert.ToInt32(SalesOrderNo.Text); // Defined earlier via GUID
/*
// Method #1: Use EpiDataView
	EpiDataView edvOrderHed = ((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"]));
	DataRow edvOrderHedRow = edvOrderHed.CurrentDataRow;
	if ((edvOrderHedRow != null))
	{
		if(Convert.ToBoolean(edvOrderHedRow["CheckBox20"]) == true)
		{
			try
			{
				edvOrderHedRow.BeginEdit();
				edvOrderHedRow["CheckBox20"] = 0;
				edvOrderHedRow.EndEdit();
			}
			catch (Exception ex)
			{
				ShowExceptMsg("Unable to clear CheckBox20.", "", "Order Entry Error");
			}
		}
	}

// Method #2: Use SalesOrderAdapter:
	SalesOrderAdapter adpSO = new SalesOrderAdapter(oTrans);
	adpSO.BOConnect();
	if(adpSO.GetByID(orderNum))
	{
		if(Convert.ToBoolean(adpSO.SalesOrderData.OrderHed.Rows[0]["CheckBox20"]) == true)
		{
			adpSO.SalesOrderData.OrderHed.Rows[0]["RowMod"] = "U";
			adpSO.SalesOrderData.OrderHed.Rows[0]["CheckBox20"] = 0;
			oTrans.Update();
		}
	}
	adpSO.Dispose();
*/
}

I’m leaning towards using the SalesOrderAdapter, but as always I’m wide open to alternative suggestions how to update OrderHed.

Thanks, Tony G.

Why?

Well, the obvious answer is because it is a business requirement for my company. Please elaborate if you have specific concerns regarding my inquiry. Thanks.

There’s no reliable way to do this. It’s a very old school way of thinking, and you would have to deal with the old school ramifications of that, record locks. There has never been a fool proof way to do this in any system. Client crashes and you’ve got locked records. That’s now one more thing that the tech staff is on call for that is non-value added.

The real question is still why. What problem is trying to be solved? Epicor does record version tracking, so one user can’t override another users information. If two people are in the same record they will quickly know when it says “this row has been modified by another user”

Thanks for jumping in, Joshua. Assuming we’re willing to forego the whole manual lock/unlock logic, is it at least possible to inform the user who is working on the same record?

Not without building out a buncha (almost certainly troublesome) infrastructure.

Like most decent systems, Epicor is a transactional application built on an idempotent API. There isn’t really any such thing as “the person working on this record”. There is only the last person that modified it.

Along those lines, there isn’t any easy way to clear a field when a user “leaves” a record. Because leaving a record doesn’t correlate to any kind of event or transaction.

As a BSA educate your company that this isnt a requirement for any other 10,000 Epicor Customers and in other systems such as Salesforce among other things there isnt a lock on modifying a Contact or a Lead either when someone else is viewing it. You are the expert that is why they hired you to guide them into best practices and the future.

I am curious if the company still uses the old Checkin / Checkout Sharepoint or have they migrated to the O365 Sharepoint where you no longer checkin/checkout.

Back to your question sir.

You could I guess use the Checkbox20 which fills in Shortchar20 with the UserID of the user - then that user needs to remember to unlock it, by unchecking the checkbox.

Sure you could fill it in and try to catch all exit events like an AR/AP Group – however note that if the user disconnects from the network, abruptly shuts down their PC, uses task manager to kill epicor then the SO may remain locked as it happens all the time on AP/AR Groups.

Hi Tony,

We have had problems in our company with two people entering the same sales order. If this is a problem that you are trying to solve also, a BPM on the sales order update comes in handy to warn user that this PO for this customer ID was already entered on xxxxx sales order by xxxxx person.

Nancy

That’s great, Nancy. We did the same thing too, but for a different reason. As for the original request, I had a heart-to-heart talk with the director, and she understood that this wasn’t going to work in the new environment.