custom exception feedback message

  

hi there it's my first time to post and I apologize if ever I posted in the wrong forum section. I love outsystems and would love to learn more about it.

My problem is that I have 2 tables (Building, CondoUnit), so one building can have many units but the unit's room number must not repeat on the same building. I made an index to accomplish that but after hitting the save button I get a big red exception feedback message "Cannot insert duplicate key row in object..."

I want to be able to replace the exceptionfeedback message with a custom message telling them that the room number they've type already exists on the designated building. I've read that creating custom messages is somewhat not good when it comes to exceptions, if ever you guys have an alternate solution please tell me so that I may learn what's the best practice when it comes to that situation. thank you :)

Solution

Hello Clintjie Lo,

First of all welcome to the forums!

Regarding that subject I think you have two options:

- You build your own exception handler that will give the feedback that you're expecting

- On the save action you check if that room number is available and do that before you actually save.

If you think about the last option, maybe would be nice to do this when you enter the room number, this way the user knows the room is taken even before he presses the save : )

Best regards,

Cristiano

Solution

Thanks Cristiano Marques,

I'm still new to outsystems I wonder if you could link or give a good sample on how to make my own exception handler. 

With regards to the last option would that be a combination of the input having onchange action, ajax refresh, and do I need to use the results of an advanced query to be able to match my input vs the one in the database or could i simply just make a statement that input widget doesn't equal to one found at the get preparation?


I appreciate your fast reply the community here is really nice :)

Hello Clintjie,

You can see this reply regarding exception handling.

Regarding the last option, you should make a onchange(or on blur) on the input and validate the room availability, then if its not available you could use the input error message and refresh it so it shows like an input error : ) you can also simply send a feedback message with the error you want.

Regards,

Cristiano


thank you cristiano the last option worked for me, I'll still go and try the link you gave me to better understand an alternative way to achieve what I need


again thank you for helping me, I'll be sure to comeback in the community if ever I need help again :)