+ Start a Discussion

Opening a visualforce page from normal apex class or from Trigger please help me

HI Everyone,

I wish to display a message to my users like "You are not allowed to edit the Close Date" in opportunity object while updating an opportunity record useing standard UI (not Visualforce page). So I want to open a visualforce page from trigger or normal apex class.


Please help me.


Thanks & Regards,


Sridhar BonagiriSridhar Bonagiri



I think you can achieve this with the help of validation rule and check for whether the close date has been changed or not and depending on that display the message to the users and this message will be displayed on standard UI only.



Sridhar Bonagiri


BSridhar is right: If your business rules are pretty simple then you can achieve it using validation rules :something like below.....if business rules are complex then use trigger.


Description:Ensures that only the record owner can make changes to a field called closeddate.
   ISCHANGED( closeddate),
   Owner <> $User.Id 
Error Message:Only record owner can change closeddate.
Error Location:Closed date