Closed vanDrielKevin closed 2 years ago
Nice to see you adopting Flows for APEX!
This is a great question. If it concerns a business error, you can model this today using error boundary events in your flow (have a look at tutorial AA6). When it comes to technical errors (and marking the activity red), we don't have support for this today, but I would like to discuss this with others in the group if this is a case that we should support. I wonder how Camunda handles this?
HI Kevin, I think you'll find it difficult to do what you are trying to do at the moment, because we don't keep track of errors in the engine at the moment. I've always thought that this is part of a system management and monitoring (& audit) development feature that we need to address in some release in the next year or two, as we start to get users with applications in production. There are a few things that might help. First, so you understand how the colouring mechanism works: the way the task colouring works is that we have a view, flow_instance_details_vw that returns three columns all_completed, last_completed, and all_current -- which contain the list of objects falling into those categories. There are 3 css tags which match those three categories, & the bpmn_viewer plugin provides the list of nodes and css when it is refreshed. We discovered that all_completed and last_completed are best shown in the same colour (grey, out of the box) & so we usually now display 3 lists with 2 colours. The difficulty you will have at the moment is coming up with a list of objects that haven't succeeded / have failed. If you could do that, you could rewrite the flow_instance_details_vw view so that all completed tasks are included in one of the two categories - say all_completed, then rewrite the subquery for last_completed to return your error objects, and change the css colour assignment for that group to, for example - red. It's just not obvious to me how you would identify the failed nodes? type of object & time as current object => assumption/probability of having stalled?
Hi Niels and Richard, First of all a big thanks to you both for giving me such a quick response!
Niels, I found the boundary events in the tutorial. This is not exact what we are looking for. Currently I am making my own ‘framework’ so we can simplify the script code behind each block. We do not anticipate where it could go wrong like you would with a boundary event. The flows we are using are only used to see where they go wrong, if they go wrong. This is why we would like to see the block in red.
Richard, Your awnser is more what I was looking for. Your explanation about the views helped a lot. I can detect an error just with an exception catch. From here I will use my ‘framework’ to update the tables. I am going to do try some work on this myself. I will post an update if it works but the plan for now is this:
Regards, Kevin (student)
Be cautious by changing "our" objects as they might get overwritten during an update of Flows for APEX. Just create your own views and packages on top of our views/packages.
Yes! That is a good point, I will create my own views so I don't interfere with future updates. Thanks for the heads up!
Hello,
I have an update for the error color change. I got it working but it might not work for everyone because of the way I detect runtime errors. I detect the errors trough an exception function in every script task. I pause the flow by removing the ‘complete_step’ line in the FLOW_ENGINE.Process_scriptTask (I saw no other way then removing this) and if the function is completed I call my own stopfunction that will make ‘the complete_step’ for me.
As an extra I also added a document to retry if a task fails. So now if it fails, the task will turn red and the flow does no continue (unless you step over it manually in the subflow tab in apex). To retry a failed task I made an extra dropdown box in APEX so you can select the blocks in error. If you press the retry button it will try to execute the pl/sql again. So if you edit a var or the pl/sql code for example it will try to execute it again and if everything is okay it will continue the flow.
I know not everything will work perfectly, and there will be some flaws that I did not (yet) think of. But it will be a good basis to work from. I have made documents that explains everything that I have done. I hope it will help other people or the flows for apex team for future updates.
https://drive.google.com/drive/folders/16bena2kMbWgZvSEBKZZqr8ofOy67ZdtG?usp=sharing
Regards, Kevin (student)
Well done, Kevin! You've done some good and interesting work there & that's prompted us to think about several improvements that we could make to improve Flows for APEX in a future release.
Remaining Tasks after 12 August Merge:
Delivered in version 21.1
Hello,
I am trying to use Flows For APEX as a replacement for the old Oracle workflows. I have a problem regarding error handing in Flows For APEX. My goal is to make a task red if it fails to execute. This way we can see where the flow went wrong. The problem is that I can’t figure out how to make the task change color. I found the plugin with javascript and css to make the blocks green or gray but I don’t know how the color change is called and how I can call my css class to make a block red this way.
Regards, Kevin (student)