Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, August 13, 2025 
 
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!
 Web Forums - SalesLogix Web Platform & Application Architect
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Reverting a value on failed validation - How?
Alec Denholm
Posts: 23
 
Reverting a value on failed validation - How?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Oct 08 10:34 AM
Hey guys,

I've put some additional validation around the Status picklist on Opportunity Details, which fires in the OnChangeAction.
The problem I'm having is that I want the value to revert back to what it was (i.e. the saved value) if the validation is failed. I've tried to achieve this by putting either the Refresh Data business rule or the Reset Entity business rule in the OnFail action of my ValidationBusinessRule. Neither of them seem to do anything though; the page refreshes, but the picklist still retains it's value, and there's the thing in the bottom left corner saying changes unsaved.
Querying the database at this point reveals that indeed the picklist value which failed validation is not saved to the database, but how do I revert the field in the client back to it's stored value? Note that at the point of the validation check, the value of opportunity.Status is already that of the new, non-validated status, and I don't know how to expose the old, saved value.

Two options spring to mind though neither is particularly elegant:
a) Place a hidden field on the form to hold the old value. Use a C# snippet in the OnFail to copy this value back into the Status picklist.
b) Invoke a duplicate instance of the current opportunity object (which should use the stored values) during validation. On failure, copy opportunity.Status from the newly-invoked instance to the current one.

I'm hoping there's a better alternative to these two.

Thanks!
[Reply][Quote]
Stephen Redmond
Posts: 190
 
Re: Reverting a value on failed validation - How?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Oct 08 2:08 PM
Hi Alec,

Did you know that there is a WhenBeforeChange event on Properties? This event passes an "args" object that has the before and after values. If you fail validation, you can throw an error and reset the value to the before value.


Stephen
www.slxmaster.com
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Reverting a value on failed validation - How?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Oct 08 2:16 PM
I have a post that describes how to get the previous values so you can change them back on my CRM Developer blog: http://customerfx.com/pages/crmdeveloper/2008/02/20/entity-change-state-and-getting-previous-values-in-sp2.aspx

-Ryan
[Reply][Quote]
Alec Denholm
Posts: 23
 
Re: Reverting a value on failed validation - How?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 7:48 AM
Thanks guys, helpful advice as always!

I was stuck on the idea of trying to change the picklist value back, when I should instead have been looking to correct the entity itself. Using the ChangeManagement interfaces made this very easy!
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/13/2025 3:08:46 PM