function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SIVASASNKARSIVASASNKAR 

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,

Sivasankar

Sridhar BonagiriSridhar Bonagiri

Hi,

 

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.

 

Regards,

Sridhar Bonagiri

Rahul_sgRahul_sg

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.
Formula:
AND(
   ISCHANGED( closeddate),
   Owner <> $User.Id 
)
Error Message:Only record owner can change closeddate.
Error Location:Closed date