BPM "Raise Error" Catch on Customization Form

Hey, how are u?

i have another issue today, this time i need to catch an Raise Exception from BPM (or know that the BPM execute a Raise Exception somehow) inside of Form Customization. for then stop custom code execution.

When debugging, epicor show the exception raised, but wont stop the execution of custom code calling the BPM Method.

Any idea?

Thanks for read.

Regards

Raise Exception BPM will actually display an exception error and not necessarily throw it back to the calling code, you can get around some of this by invoking the BO’s yourself. If you invoke the BO it will (generally) throw an actual exception back at you

on this case im doing that:

on customization code:

dutyRow.BeginEdit();
dutyRow["DutyAmt"] = newAmt;
dutyRow.EndEdit();
oTrans.Update();

but now i have to add some validation on the BPM “Update” from BO

then i resolve this using BPM whit custom code and external code.

string sMsjeError = string.Empty;
callContextBpmData.Character01 = string.Empty;
callContextBpmData.Checkbox01 = true;

try
{
    Container.BPM.Contenedor container = new Container.BPM.Contenedor(Db, ds);

    callContextBpmData.Checkbox01 = container.VerificarMinimosDuty(out sMsjeError);
    if (!callContextBpmData.Checkbox01)
    {
	callContextBpmData.Character01 = sMsjeError;
    }
}
catch (Exception ex)
{
    callContextBpmData.Checkbox01 = false;
    callContextBpmData.Character01 = ex.Message;
}

Did you check “terminate on error” in the BPM?

Checked

oTrans.Update() is invoking the built in adapters so it will handle the popup the normal way that it does.
If you were to create an instance of the BO in your code and invoke Update method directly then you would receive the exception

Can i instance a BO using the actual form on form customization?

Yes you can write custom code to instantiate a BO and then invoke the Update Method you’ll have to get the dataset and pass it to the BO etc…

Ok, so, how can i get the DataSet? i know the GetById on custom code outside of epicor… now im inside on a custom form, dont have a Session object from Ice.Core, or impl class instanciated, have an example to show? i just using adapters cause im dont know hoy get the impl class inside form customization.

There are a lot of examples in this forum of how to do this here’s one with some sample code

thanks a lot! again! :slight_smile: