I have an Updateable Dashboard. There is only one field that is updateable. Issue is when someone updates the record, while another user has the dashboard open. When user1 saves, their data is saved!! Then User2 makes changes and saves. User1 changes are overwritten by User2.
How do I prevent this? What are some ways you have gotten this to work.
I am going to assume I can do this for OrderRel as well. I am not seeing where the tt is being set and used in the update. It looks like the whole query ds is being processed.
Should I even care about the trace log? I see my change. But I also see the queryDS being sent with more records than I updated.
You lost me there Ken. The UBAQ’s work via BPMS (even the standard BO based ones generate a BPM behind the scenes).
If you click on Advanced BPM option int eh UBAQ Update Processing you can check if the ttResult.SysRevID == the SYsRevID on the Db.
and if they are NOT the same that means that the data has changed and you should abort the update.
All right this was a giant pain in the ass LoL. Here is what you need to do
On the BAQ create a calculated field which will Cast the SysRevID to a BIG INT
Then on the BPM side Pre-Processing on Update get the current SysRevID and convert it also to a big int
Like this
var mycurrentRev = IPAddress.NetworkToHostOrder(BitConverter.ToInt64((from y in Db.OrderRel where y.SysRowID == x.OrderRel_SysRowID select y.SysRevID).FirstOrDefault(),0));
Note you will have to Click on Usings & References and add
using System.Net;
Then it is as simple as comparing the two values.
foreach(var x in ttResults.Where(r=>r.Updated()))
{
var mycurrentRev = IPAddress.NetworkToHostOrder(BitConverter.ToInt64((from y in Db.OrderRel where y.SysRowID == x.OrderRel_SysRowID select y.SysRevID).FirstOrDefault(),0));
if(x.Calculated_Calc_SysRevTT != mycurrentRev)
{
var message = "This Record has been updated by another User. Please Refresh Dashboard and make your change again.";
throw new Ice.Common.BusinessObjectException(
new Ice.Common.BusinessObjectMessage(message)
{
Type = Ice.Common.BusinessObjectMessageType.Error,
});
}
}
Note do not do the actual updating here, let EPicor do the update in their “EpiMagical” base method. Your job is only in Pre-Processing to stop / raise an error if needed. Otherwise do nothing.
Just in case it matters, a bigint in SQL server is a signed integer and the rowversion (SysRevID) value is an 8-byte array. SQL will cast it to a bigint, but if the SysRevID is high enough, the result will get flipped to a negative value, which a problem if you want to sort on the result.
In C#, you can convert the raw SysRevID value to a UInt64 (or unsigned long) like this:
Hi Jose,
I’m researching a solution to an issue where two separate users are entering data on the same updateable dashboard (separate fields) but on saving the data one is overwriting the other as they are both open at the same - one with new data in a field and the other data with old data.
I’ve resurrected this solution as it seems to be relevant to the problem I have. However I’m unable to figure out from the solution the BPM bit how it is implemented - can you help even though this is 4 years old