How to deal with exeptions or errors in appian. I would like to show a custom error message to the user instead of technical terms. At the same time , the errors with specific technical terms must be logged into a file ,so that the relevant team can look into it. So how do i do these two things, Custom error message and Error logging .
Thanks,
Discussion posts and replies are publicly visible
The answer is that it depends on the context. Some errors are handled automatically by Appian and do not give you the ability to implement a try/throw/catch pattern. Other errors do. So ti really depends on what objects you're using and what the nature of the "error" is that you want to catch and provide a user-friendly display of.
Lets say for a send email smart service , I want to display a user friendly message when the email is not sent or for invalid email address.
Another situation will be , a user doesnt have privelege for a page or some page had error in opening up . In this case I saw the error page given by appian by default had all technical details instead of a user friendly message.
So like these scenarios, is it possible to handle them with a custom errror message
Ok thank you , In your previous answer , it's about routing to a user defined task but my requirement is kind of different.
I have a page where user can enter recepient mail address. Once he submits , the process model takes the flow to the send email service, here if any error occurs in sending email, I must show a alert to the user stating , send email has failed or some user friendly message.
So routing to a new task wont help in my case.
Is there any solution for this , thanks in advance(with feeling!)
Yes. If you make the whole process synchronous (so you 'chain' the first User Input Task, the Send E-mail Smart Service and the next User Input Task) then the end-user will see the results of the send email immediately.
But the results are going to come as a task right. Will it come in the same screen of the first task like alert?
Will try it anyway , thanks
When you chain Smart Services together you get a 'synchronous' experience - so if your first screen is where you input some email addresses, then submit it'll run the Send E-Mail synchronously in the background and then immediately display the next User Input Task, so the experience the User will get will be the first screen and the immediately the second screen.
But the send email smart service is breaking when i give invalid recepient emails and i see a red line on monitoring.So its not going to the next node where i check the process variable value.
In what way is your email address 'invalid'? You should be adding validation to the form where you're capturing those email addresses so that they at least conform to a valid email address format (they may still not be viable email addresses but there's no way of knowing that before you send them!!). You can do this by adding a validation to the field where you capture the email address. Use the fn!regexmatch() - you'll need to add this as a plug-in - and there are any number of regex patterns out there to validate the email address format.
So what does the output in send emaill smart service give then? It will be just saying if its a viable email? So, for incorrect format ,its going to break?
When I provide an invalid email address I see this as the Data Outputs:
Sorry for the late reply, but somehow this smart service is breaking for me.I have attached screenshots below. Any help is much appreciated, thanks.
What is the error? If you right-click the node that is in error you'll get a menu. Select the "1 instances" option, highlight the node in the list and then select the 'View Node Details': You should land on a dialogue with an 'Error' tab selected where the details of the error are, a bit like this:
Here is what i got
Ok, so looks like the Send E-Mail node expects to have at least ONE valid recipient. I guess if you had one valid email address and one invalid one it would work (worth trying that out).
But as I said previously if you're capturing the email addresses in your first User Input Task then you should add validation to the field(s) where you're capturing the email addresses and not let the User submit the form if the email addresses are invalid.
Yes you are correct, it did go to the exception flow when one mail was valid in the send email smart service node. But that's bad as we might be loading a group of recepients from a cdt and it's not guaranteed that atleast one will be valid all the time.
Thank you , anyway.
So, even in this circumstance you should write a rule to validate the format of the email addresses and route to someone to fix/remove BEFORE the Send E-Mail smart service is invoked. If you encapsulate this as an Expression Rule you can use it in the Process, AND you can re-use it in any interface where you're capturing Email addresses. And it's just good practice to validate the data you're working with before passing it downstream for processing.
That's ok we can do a basic regex check. The main purpose of this question, was to find a approach to handle errors and exceptions of a smart service or anything, Now I came to know we can make use of the node outputs to make exception flows and custom error messages.
It will also be nice if appian let's us to edit the basic product code itself. Many low code development platforms like wordpress let's us change the background code completely and add new features. Appian must consider letting that flexibility for the designer. And yes, those who find it difficult to code are always allowed to use the abstractions provided by appian.
Thank you
I understand the request, but if Appian allowed you to change the base code then in effect you'd be creating a fork of the code and it would be unsupportable by Appian, which is part of the platform offering - the code AND the associated support. You can write your own plug-ins to extend the platform capability, and you can submit requests for changes to existing features (e.g. to ask for the Send E-mail Smart Service to allow you to implement a try/throw/catch pattern and implement your own error-handling!)