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!
		
			 | 
		
			
		
			 | 
				
					Validation Business Rule - Message Box   
						Posted: 07 Jun 08 4:16 PM
					 | 
				 
					| I'd like to perform various validations before saving an entity. If any of the validations fail, i want it to be displayed as a Message Box (not dialog form). How can i achieve this? | 
				 
					 | 
				 
			  | 
		
			 | 
				
					Re: Validation Business Rule - Message Box   
						Posted: 09 Jun 08 3:48 AM
					 | 
				 
					The following will work on the insert opp screen - change it for the other entities and screens. Hopefully it should give you the idea...
 
 Sage.Entity.Interfaces.IOpportunity entity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity; Sage.Platform.Orm.Interfaces.IPersistentEntity persistentEntity = this.BindingSource.Current as Sage.Platform.Orm.Interfaces.IPersistentEntity; String validationString = "";
  if (persistentEntity != null) { 	if (entity.EstimatedClose.ToString() == null | entity.EstimatedClose.ToString() == "") 	{ 	    validationString += "<li><b>"; 	    validationString += "Estimated Close" + "</b></li>"; 	}
  	if (validationString == "") 	{ 	    persistentEntity.Save();				 	    Response.Redirect(string.Format("Opportunity.aspx?entityId={0}", (this.BindingSource.Current as Sage.Platform.ComponentModel.IComponentReference).Id)); 	} 	else 	{ 	    this.DialogService.ShowMessage("<div style=color:red><b> Please enter the following fields:</b></div>" + "<br><ul>" + validationString + "</ul>" + "<br><div style=color:red>(Fields marked with a * are mandatory)</div>"); 	} } 
  etc.... | 
				 
					 | 
				 
			  | 
		
			 |  | 
		
			 |  | 
		
			 |  | 
		
			 |  | 
		
			 |