How to know which task the model failed on?

Hello,

I have a model which catches errors in a subprocess in the same manner as the example given here, shown below:

Is there a built-in way to determine which of the tasks in the subprocess failed / was the last to execute before the event subprocess was triggered? My actual model has over a dozen steps, so it is not practical to set a variable for this myself, and I was wondering if there is something built in for this. A ‘hack’ of sorts that I’ve thought of would be to query ACT_HI_ACTINST for the latest activity, but that isn’t exactly elegant.

Thank you!

You don’t need to hack anything to get access to the history of the process just use the engine’s HistoryService to create the query your want.