I have an updatable dashboard that multiple users use to update the Job. The problem I had was that if a user (user1) had their dashboard open and another
user (user2) updated and saved changes on the JobHead (either job entry or the dashboard) while user1 had the dashboard open when user1 save their changes it would overwrite the changes from user2.
I found a solution that Jose Gomez had posted using a BPM on the BAQ with the following code
foreach(var x in ttResults.Where(r=>r.Updated()))
{
var mycurrentRev = IPAddress.NetworkToHostOrder(BitConverter.ToInt64((from y in Db.JobHead where y.SysRowID == x.JobHead_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,
});
}
}
it works great stops changes being made to the JobHead table but if I update one of my UD fields from JobHead_UD it does not work.
The code checks for a difference in value of the on the SysRevID on the JobHead and ttJobHead, is there any way to prevent an overwirte for the JobHead_UD or this there another way of preventing this.
Hey Rich - I have something for you to try if you are on version 10.1.600 or newer.
Changes were made in the 10.1 code line to automatically manage the SysRevID lock checking if the SysRevID field was part of the UBAQ so you should not need to write any code to have the Optimistic Lock Check apply.
Try this in a Dev Environment or on a test copy of the UBAQ / Dashboard so as not to mess up your live processing…
Dump your custom BPM code from the UBAQ and instead add the JobHead.SysRevID field to the Display columns for your UBAQ. Save the UBAQ and test in your Updateable Dashboard. You should now see the SysRevID data in your Dashboard (you will hide that once you know this works).
Test the Optimistic Lock Checking to see if it works as you expect for both the JobHead and JobHead_UD fields in your UBAQ. I am sure it will work for your JobHead fields but due to the internals of UpdateExt, I believe that the JobHead_UD fields should be covered but not 100% sure.
Assuming everything works as you expect, lets go back into the BAQ Designer and try and hide the SysRevID column. Load the UBAQ and go to the Display Fields, Column Select sheet and click on the “Field Attribute Editor” Icon - second from the bottom in the stack of icons between the Available Columns and the selected Display Columns.
When the “Display Field Attributes Editor” dialog loads, select the SysRevID column, and then click the “New” Icon that displays above the grid of Attributes (right side of the form). A new row will be added to the Grid and on that new row there will be an “Attribute” drop down combo. It is a true combo so you can enter a value that is not in the drop down list so enter: IsHidden (capital I and H no spaces). Now click on the “Value” field for that row and set the value to: true Leave Overriden checked and save out of that form and save the UBAQ.
Test your Updateable Dashboard - I believe that it will honor the IsHidden and hopefully you will not see the SysRevID column but it should still get applied automatically as part of the Update. If the column is still visible, you will need to hide it using the Dashboard properties.