The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Business Rule error message handling
Posted: 24 Jul 09 10:40 AM
|
I am writing a simple validation business rule but am unsure on how to raise an error to display in the client.
The ContactDetails form already has a business rule HasPropgationChanges but I want to add additional rules onto this before saving. Only problem is that you can only have the one business rule so I can't set another with a "Show Message" option.
Whats the best way to handle displaying messages to users about various validation points on a form?
|
|
|
|
Re: Business Rule error message handling
Posted: 28 Jul 09 2:56 PM
|
Tony, I will typically throw an exception in a validation business rule. This will pop a message to the user and terminate further execution:
throw new Sage.Platform.Application.ValidationException("MyField is required");
I would then set the save button to call the validation rule followed by the save method. If any exceptions occur, the save won't fire. |
|
|
| |
|
Re: Business Rule error message handling
Posted: 29 Jul 09 11:12 AM
|
Why throw an exception in the first place if you can simply return false and setup a ShowMessage action for OnFailure?
Am I missing something? |
|
|
|
Re: Business Rule error message handling
Posted: 29 Jul 09 11:20 AM
|
Because I want the message to state what the problem was.
The ShowMessage action only seems to allow a restricted message which wouldn't be related to what the error was.
You can only have one business rule with a show message action |
|
|
|