Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- RunAs to update locked Opportunity
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
RunAs to update locked Opportunit y
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2013 12:53 PM
I have an object that is linked to an Opportunity. When this object is updated it needs to update the opportunity. However, in some cases the opportunity is in an approval process and this causes the error "; first error: ENTITY_IS_LOCKED, the entity is locked for editing: []". Can I use the RunAs to make the class run under an administrator because even though this opp is locked it needs to be updated. I only see runas used in Test Classes.
Thanks,
Tena
Re: RunAs to update locked Opportunit y
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2013 09:35 PM
<p>Like other Apex classes, all custom controllers run in system mode. Consequently, the current user's credentials are not used to execute controller logic, and the user's permissions and field-level security do not apply. So you can't use RunAs().</p>
Rakesh Kumar LinkedIn
Salesforce Certified developer, Administrator, Consultant
Answers/Suggestions are my own.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Re: RunAs to update locked Opportunit y
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-04-2013 01:59 PM
According to what I read about system mode is that it doesn't take the user into consideration when running the code. I find this odd becasue when an opportunity is locked and a user exectues a trigger that I wrote there is an error of "ENTITY_IS_LOCKED". However, if I do the exact same thing as an administrator I don't get the error. Does this mean then that the opportunity being locked has nothing to do with this issue?
Thanks,
Tena

