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
PascalPascal 

Visualforce/Extension or Just Apex

Community:

 

I have a requirement that I'm not sure how to go about implementing.  In a nutshell, I want users to edit a campaign if the user's region (a custom field) matches the campaign's region (another custom field).  If there is a match, the edit is allow; otherwise, the edit is not allowed.

 

Should I be overriding the edit functionality with VF/Controller extensions, of is this a case of Apex Sharing?  I don't necessarialy want to hide records, just prevent the editablility of some.

 

Thanks.

CaffeineCaffeine

Pascal,

Given the parameters of the problem, the simplest solution is to override the Edit button with an APEX page, having the page check the conditions and then re-directing the Campaign Edit only if the conditions are ok.

 

Implementing with Sharing rules would be messier than what it is worth in my humble opinion.

 

Hope this helps.