53
Views
6
Comments
How to display customize message to user?
Question

Hi, I have a requirement like i want to display customize message to user when user adding duplicate record in form.

example:- I created entity(States) already state there in DB again entering from UI with same name.

exception throwing because i set Index as Unique for that state name attribute. 

Now, i want display cutimise exception message to user instead of DB exception message.

please advice 

2023-04-16 15-25-31
Krishnanand Pathak

Hi,
You can use exception handler inside your Save action.
As shown below

Regards
Krishnanand Pathak


2021-09-06 15-09-53
Dorine Boudry
 
MVP

I would say, validate before update in your crud wrapper

So do an aggregate with filters : different id, same name

If found, don't do the update/create and set your own exception with proper text ( or some other way of communicating problem back to screen)

Dorine

UserImage.jpg
kishore reddy

how to do with aggregate. can you share a example if you handy ?

2026-02-26 06-29-24
Rahul
 
MVP

Hi ,

In addition of @Dorine Boudry said , the implementation is in below oml.

StateApp.oml
UserImage.jpg
kishore reddy

thank you Rahul 

2024-09-12 02-43-38
Deepsagar Dubey

Hi @kishore reddy 

If you applied unique index to your entity then in action when you save new record use these exception handler there in same action because if duplicate record came then it'll raise an exception.

By default all exception handled here OnException if you don't handle it in your action.

I hope it'll help you.

Thanks
Deep

 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.