+ Start a Discussion
Uves RavatUves Ravat 

Update Lines

Hi,

 

I have trigger that runs if i change any details of any fields in my Tax object. I have two field Tax Value 1 and Tax Value 2. if i do any changes that would affect any values i want a message box appearing say that Value 1 doesnt match value two. if it does it should give the user two options update the value 2 (for example) by one button or dont update value two 

 

Thanks

Uves

(want it like message error box in java)

Best Answer chosen by Admin (Salesforce Developers) 
crop1645crop1645

Triggers can put errors onto the user interface through either the  Sobject addError method or, not ideal, throwing an uncaught Exception

 

However, the user interface will take this error, and,

 

* if a standard SFDC edit/detail page, show the error in red just like any validation rule error

* if a VF page, show the error in the pageMessages VF component

 

To do something more exotic will require a VF controller/VF page -- look for tips on that discussion forum. The trigger would throw the error and the VF controller would catch it, setting up other getters to provide dynamic control over the user interface