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!
|
|
Any way to return values to Show Message from a business rule?
Posted: 26 Sep 08 8:22 AM
|
We have a few validation rules around the submit of a form on the 7.2.2 web portal (no blank description, must have a related object linked). Currently I have a validation business rule which returns a message if it fails and on success it fires a second validation rule which also returns a message if it fails and saves the record on success.
What I would like to do in this scenario is to have the business rule check both/all validation events and return a message to the Show Message event with the appropriate failure message. Has anyone any insight on something like that? |
|
|
|
Re: Any way to return values to Show Message from a business rule?
Posted: 26 Sep 08 2:29 PM
|
I just answered this over on IT-Toolbox so I thought that I would answer it here to:
I wouldn't try and use ShowMessage. If you look at some of the pre-canned rules (using Reflector), you will see that they will throw a ValidationException which will produce a message box:
throw new Sage.Platform.Application.ValidationException("There is a problem here!");
Stephen www.slxmaster.com
|
|
|
|
Re: Any way to return values to Show Message from a business rule?
Posted: 26 Sep 08 3:08 PM
|
But while that suggestion will work, it does not allow one to specify the title on the validationexception dialog. We're a little picky about branding, so we'd rather not have the default "Sage Saleslogix" on a data validation dialog message. Maybe I'll poke around and see where that resource is coming from so I can change it.
Thanks for the reply (both here and there). |
|
|
|
Re: Any way to return values to Show Message from a business rule?
Posted: 26 Sep 08 3:21 PM
|
Instead of using the ValidationRule action you can use a C# snippet action. Then you just call the validation rules in code and display the message yourself. Something like this:
if (myentity.Rule1() && myentity.Rule2()) { DialogService.ShowMessage("The validation rules did not pass. Tell the user something here"); }
BTW, what are you doing on ITToolbox? Don't you know this is the place to get all the good info? |
|
|
|
Re: Any way to return values to Show Message from a business rule?
Posted: 26 Sep 08 3:31 PM
|
Yes, that's more along the lines of what I'm looking for. I just need to confirm that the redirect to the newly created entity (ticket, in this case) happens as it would with a regular validation business rule wrapped around this all. Thanks, Ryan.
As for ITToolbox, well, sometimes you catch twice as many fish with two nets. |
|
|
| |
|