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
EPSWDEVEPSWDEV 

Do extension controllers run in system mode ?

I am planning on overriding a CustObj1's delete button such that I can  delete the custObj record in question and I can also delete some other object records with no explicit link or relationship to this record.  I came across a post which floated the idea of creating a webservice that does the delete  and bind the delete button to that webservice. and the reason to use webservice is that is runs in system mode hence users permissions for that object does not matter and we can still delete the object record(s) regardless of who created it, which makes a lot of sense. Now this was a old post and I am new so I am wondering if , I were to override the delete button with a vs page that has and extension controller that deletes the different object records  will it do it only if the user has permission for all the records?

Thanks,
JeremyKraybillJeremyKraybill
Apex code always executes in the system context, except if it has "with sharing" declared or is in an "executeAnonymous" call.

See the dev guide chapter on this.

Jeremy Kraybill
Austin, TX
EPSWDEVEPSWDEV
Thanks for the link !