Sql Unique constraint


Author
Message
Nikki Chase
Nikki Chase
StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)
Group: Forum Members
Posts: 13, Visits: 18
Hi,

What is the preffered way to handle unique constraints in SF? If I attempt to save a dupe SF returns the Big Bad Error box which is fine but I would like to give the user a little better message. For now I just added a method to check the value in the BO's broken rules method and that seems to work fine however it does mean that the check is being performed twice.

Can I trap for this exception and display an alternate message? 

Thanks   

Gary C Wynne
Gary C Wynne
StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)StrataFrame Beginner (46 reputation)
Group: Forum Members
Posts: 26, Visits: 236
Hi Nikki

From the Business Object Events Overview in the documents:-

The ErrorSaving event is raised only when an exception occurs on the server while executing a Save operation.  The exception displayed here originates from the server and provides the developer with detailed information as to why the query or save operation failed.  This is extremely beneficial to the developer, especially when initially programming the business objects.  Since the detailed error that occurred on the server is brought all the way to the form level, this releases the developer from step-by-step debug sessions to determine why the query failed.  By default, a StrataFrame form will automatically display any save errors to the end-user.  To prevent this message from being displayed to the end-user, the AutoShowSavingErrors property on the form must be set to False.

So, you can test and handle the ErrorSaving event and surpress the big-bad error by setting the AutoShowSavingErrors property to false.

HTH

-=Gary

Nikki Chase
Nikki Chase
StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)
Group: Forum Members
Posts: 13, Visits: 18
Thanks Gary!

That makes perfect sense I just didn't see it in the docs but then again I was probably a little cross eyed.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Gary knows what he is talking about Wink
Gary Wynne
Gary Wynne
StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)StrataFrame Beginner (16 reputation)
Group: Forum Members
Posts: 10, Visits: 40
Hi Nikki,

The problem when you start working with a new framework in a new technology is that there is sooooo much to take in, even if the answer was painted across your forehead, you probably wouldn't see it Smile

So, take a rest from your heavy (last) weekend of framework analysis and get ready for the coming weekend and you can start all over again w00t

Best

-=Gary

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search