Cancel the delete method

Hi,

I have a customization on the UD103Entry and I need to have a validation on the delete operation for the UD103A dataview.

Actually, I have a BPM in Pre mode and I use the RowMod on the UD103A table to determine if the delete is for the UD103 or the UD103A table and depending on my validation, I raise an exception to abort the delete operation.

The BPM work perfectly except for one thing, when the delete operation start, the row in my UltraGrid who handle the UD103A data are remove for the collection and after the exception was raised, I need to call a refresh on the UI to get my row back.

Regards
Al

It will be helpful to show your BPM and Epicor Version.
As far as I tested, the grid has not been refreshed in 10.2.700.

Hi Yoonani,

It’s with Epicor 10.2.600

try
{
var allRows = ttUD103A.Where(r => r.Company == callContextClient.CurrentCompany &&
(r.Updated() || r.Deleted()))
.ToList();

if (allRows.Count() > 0)
{
ECS.ExtBPM.HARNOIS_21_038 dll = new ECS.ExtBPM.HARNOIS_21_038(Db, callContextClient, callContextBpmData, true, @“c:\temp\harnois-21-038.txt”);

foreach (UD103ARow oneRow in allRows)
{
UD103ARow orgRow = ttUD103A.FirstOrDefault(r => r.SysRowID == oneRow.SysRowID &&
string.IsNullOrEmpty(r.RowMod));
if (!dll.LineCanBeDeletedOrUpdated(oneRow, orgRow))
{
string msg;

if (oneRow.Updated()) // Updated…
{
msg = “Il est impossible de changer le statut de la relâche ou de changer la pièce si la ligne ou les composantes de celle-ci contiennent un no de BT ou une no de PO.”;
}
else // Deleted…
{
msg = “Il est impossible de supprimer la ligne ou les composantes de celle-ci si ils contiennent un no de BT ou une no de PO.”;
}

throw new BLException(msg);
}
}

}
}
catch (Exception e)
{
throw new Ice.Common.BusinessObjectException(e.ToString());
}

Hi Alain.

I think the BPM has no problem.

Maybe you are using the UltraGrid with customized form not the UltraGrid in vanilla form.

If it is, you need to add a code to the Before UltraGrid Row Delete event in UI not in BPM.

Regards.
YH

Hi Yoonani,

I don’t know why, but instead of raising an exception in my code (BPM), I used the widget and it work perfectly…

Regard
Al