7/4/2025 4:29:49 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
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!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Cancel Save and prompt a user friendly message
Posted: 06 Oct 09 7:45 PM
|
Hi there,
I have a custom business rule to be executed before saving a record and if the rule fails, I would like to display an user friendly message to the screen. My current approach is to add a C# Code Snippet to BeforeInsert or BeforeUpdate Event, then throw a new ApplicationException if the business rule fails. This prevents saving the record, which is good, however, the message displayed is not user friendly. For example:
'An exception occurred executing the dynamic method Ticket.OnBeforeInsert.: [My exception goes message.]'
It would be nice if I can just display my custom exception message. Any idea? or other approach?
Regards,
Henri
|
|
|
|
Re: Cancel Save and prompt a user friendly message
Posted: 07 Oct 09 3:30 AM
|
Instead of letting the built-in SLX Exeption handler deal with it, put a try catch around your code and in the catch use the dialogservice to display a message - it's not as pretty, but it means that you'll have more control. |
|
|
| |
|
Re: Cancel Save and prompt a user friendly message
Posted: 07 Oct 09 6:55 PM
|
Hi David,
I did a search on the forum, it seems like DialogService can be accessed via this identifier. My situation is different, please see the following code I have:
namespace Sage.BusinessRules.CodeSnippets { public static partial class TicketBusinessRules { public static void OnBeforeUpdateStep_PreExecute( ITicket ticket, ISession session) { this.DialogService <--- cant access this identifier because it is a static method. } } }
I cant access 'this' identifier because I am add C# Code Snippet to the Event Business Rule. Any idea? Can you please provide me some sample code?
Thank you so much. |
|
|
|
Re: Cancel Save and prompt a user friendly message
Posted: 08 Oct 09 5:05 AM
|
Hi
I'm afraid I'm not sure exactly what you'd need to do, having not done it before. You could use the following syntax, except this is missing something...
Sage.Platform.WebPortal.Services.WebDialogService service = new Sage.Platform.WebPortal.Services.WebDialogService(); service.ShowMessage("Test");
Unfortunately it needs an IPageWorkItemLocator reference in the empty brackets and I'm not sure what to put in there...
Sorry I can't help any more! |
|
|
|
Re: Cancel Save and prompt a user friendly message
Posted: 14 Oct 09 6:10 PM
|
You can add a message to your exception as well - it takes an optional message as a parameter. For example:
throw new Sage.Platform.Application.ValidationException("Field xxx is required.");
This pops a java alert box with your message to the user and halts execution of the save.
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|