How to handle the exception of a node in process and define a different flow if exception occurs?

Hi,

My requirement is I need to handle the exception (Technical) which occurs in any node in a process and once exception occurs I need to follow a different flow to inform the end user about the exception occurred and complete the process. All the nodes are connected through activity chaining so in both success or error scenario an output is expected from the process.

 

Regards,

Balaji.R

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi @rpbalaji2006 as per my understanding, if you are more. Concern about performance, then do not use timer because it runs in background which degrades the application and server performance.

    Now coming to your query, first of all, end-user should never be informed about errors, because it's the responsibility of administrators to deal with these errors and because they are configured under alerts tab hence they will be reported by Appian and also they will have e access to designer to check the respective alerts.

    You should never complete the process in case if node breaks, because this will cause you unexpected response / behaviour.

    For example, you next task is completely depending on previous process response, and now because you have timer configured so it will trigger the next process, now to handle that, you need to define a gateway which checks for a variable if it's null then terminate the process, but process should not be configured in that way, because let's say, your task got broken, and if process didn't terminate then admin team can inspect and fix the issue by adding the patch and will restart from that node.

    Timers are best for the use case when you want to configure some schedulers in your application.

    Hope it will be helpful to you.

  • 0
    A Score Level 1
    in reply to aloks0189
    Hi aloks176,

    Thanks for your response, in our case the end user needs to be informed about the status of the transaction as the process is a Synchronous process and not asynchronous. The point which you have mentioned "end-user should never be informed about errors" will be true if the process is asynchronous and in that case the end user will submit the task/form and the administrator will correct the process if there is an error in the node.

    But in my present scenario, as I need to handle the exception case I need to wrap the node in a subprocess and define the flag variable and timer to handle the exception and follow a exception path and complete the process and inform the user that there is an error in the transaction.

    If in case if you feel the above case can be done in a better way without using timer event, let me know so that ill try it out

    Regards,
    Balaji.R
Reply
  • 0
    A Score Level 1
    in reply to aloks0189
    Hi aloks176,

    Thanks for your response, in our case the end user needs to be informed about the status of the transaction as the process is a Synchronous process and not asynchronous. The point which you have mentioned "end-user should never be informed about errors" will be true if the process is asynchronous and in that case the end user will submit the task/form and the administrator will correct the process if there is an error in the node.

    But in my present scenario, as I need to handle the exception case I need to wrap the node in a subprocess and define the flag variable and timer to handle the exception and follow a exception path and complete the process and inform the user that there is an error in the transaction.

    If in case if you feel the above case can be done in a better way without using timer event, let me know so that ill try it out

    Regards,
    Balaji.R
Children
  • 0
    Certified Lead Developer
    in reply to rp_balaji

    Hi  i agree, correct me if i am wrong, when you talk about Transaction, definitely you will be allowing standard amount of time for the process to complete it's processing, hence anyhow if you hold the process for that long amount of time, will cause you activity chaining break, and will assign an another task to the end user, hence user won't be informed through the interface, instead he need to pickup an another task else you need to send an email notification.

    Also when you talk about transaction, you must be very careful about performance, which you need to sacrifice if you want to go for timers. Let's say, there are 10,000 instances for your process in production, which means there are 10,000 active timers which will cause you lot of performance issues.

    So, instead of this the better way could be, create a task report for this Transactional Process (which only contains Transaction logic excluding User Input Task, and will be triggered only when User Input Task gets submitted) and capture it's start time then compare the time duration between it's start time and now() if it's more than your defined business transaction rules then simply get the process instance it and terminate it using subrocess

    Also, this an be automated using one Cleanup process, which will collect all this data, and if there are any process instance with matching criteria, simply terminate them, and before termination, get the initiator of that process and trigger an email post termination of this instance.

    Also, you can query for those processes whose status is Paused by Exception with in the context of this Transactional Process model, which will return you those processes which have failed during it's execution.

    I believe this could be the better approach, however it's your call, because you will have more understanding about your business requirement. This is just an another approach which can be feasible for your scenario.

  • 0
    A Score Level 1
    in reply to aloks0189
    Hi aloks176,

    Thanks for your detailed explanation. In my case it is not Appian user input task which will gets submitted to trigger a process, the UI which the user uses is a external HTML application and Appian process is triggered through WebAPI. So in this case I don have any user input task used in the process flow and it is only nodes which are related to DB and integration objects, in here if any node fails i need to terminate the process and send back the error response as an output of the process. In here I have an option in webapi that OnError attribute of startprocess smart service can be used to inform the user if there is any exception. But out of curiosity and knowledge purpose I would like to know what is an ideal way of defining a exception flow in the process as per the above requirement. As you said using a timer will be a set back as the system will have lot of process in memory in waiting state and that is a performance overhead.

    And in your response, in 3rd stanza you have mentioned to create a task report and with the time comparison logic you have asked to terminate the processes using a subprocess. So in here the sub process u r talking about is a individual process which will run as a batch and clear the processes or this subprocess needs to be called inside the main transactional process.

    May I know the function or smart service name which can be used to get the processes which are failed due to exception for a particular process model.


    Regards,
    Balaji.R
  • Hi, onError only works if the process fails to start.

  • Correction.  OnError also worked when there was an identity number generation issue.