How to change the message?

Hello guys,

Im new to this technology can you please help me understand how to change the message which says "Cannot insert duplicate key row....."

In the above screen i'm entering duplicate movie title and now i want to change the message for that

mvp_badge
MVP
Solution

Hi ,

you need to add exception on a screen action or server action.

follow this post

https://www.outsystems.com/forums/discussion/62146/throw-an-exception-to-another-module/

Hope this will help you.

Regards

Rahul

Hello Ritesh,

Yes you are getting this error because you have Unique index in the Title attribute in the table.

Just remove or change the Unique key from Yes to No then you may be able to enter Movie name and you will not get this error.


Kindly let me know the feed back. 

Thanks 

Ajay Sharma

mvp_badge
MVP

Hi AJay,

this is not a solution of Ritesh Question. he want change exception message.

Please read  question carefully before provide solution.


mvp_badge
MVP
Solution

Hi ,

you need to add exception on a screen action or server action.

follow this post

https://www.outsystems.com/forums/discussion/62146/throw-an-exception-to-another-module/

Hope this will help you.

Regards

Rahul

Champion

Hi Ritesh,

You can do exception handling in our code. For this specific case it is a Database Exception.

You can have database exception handler in your code, for this Save Button action and in message you can write your own custom error message to be display on the screen.



mvp_badge
MVP

Hello Pravi,

I believe this is not a good solution for this scenario.

Because, if you implement it that way, every single Database Exception will return the same message.


Kind regards,

Rui Barradas

Champion

Hi Rui,
We can go with the approach you suggested.

OR

We can define a custom exception handler message in such a way so that it works for all database exception like "An error occurred while saving the data, please contact administrator."

mvp_badge
MVP

Hello there Pravi,

Thank you for pointing that out and giving an explanation for that use case.

The only issue I see with that second approach is that a generic message is not clear for the user why the error is happening.


In this case, since the error is happening because a duplicated title, it could be helpful for the user to understand why it is occurring and adapt the title accordingly :)


Kind regards,

Rui Barradas

mvp_badge
MVP

Hello there Ritesh,

Hope you're doing well.

It seems that your Title attribute is defined as an unique index for your entity Movie.

So, by the time you try to insert a record with the same value for Title, it will return a Database exception (with that message).


I suggest that you execute the validation in the logic by the time you press the button "Save".

You can execute a query to compare in the Database if there is already a record with that title. If so, you show a feedback message of type error to the user with the message that you pretend. If not (query returns empty), than you proceed and create the new record.


Kind regards,

Rui Barradas

mvp_badge
MVP

Hi Ritesh,

For handeling this duplicate name message, you can handle this exception in your Save button action. Just drag and drop Exception handler and use message node to show the error message.

It will look something like this.


mvp_badge
MVP

Oh, I am little late I think  

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