Questions tagged [rollback]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
31 views

[apex]: Database.rollback(sp) not rolling back in my trigger

I am playing around with Database.setSavePoint() in a trigger. I put it at the top of my BeforeUpdate method and then I roll back at the end of the method. Then I try to modify an Opportunity record ...
1
vote
1answer
35 views

Rollback of a transaction in case of Gov Limit Error while using AllOrNone false

Will the entire transaction be rolled back in case of Governor Limit exception if I have fired some partial saves done? e.g. if the gov limit exception of 100 SOQL is hit while execution of contact ...
0
votes
1answer
19 views

How to handle failed updates when updating multiple Records in List

I have a Apex job that runs every night to change a field in multiple records. I've added some validations to the Object that are preventing some records from being saved. The problem is even tho ...
0
votes
0answers
45 views

@future method not getting called from catch block

I am calling a webservice (synchronous) and in case of CalloutException, I'm trying to create an error log in a custom object. The problem is, the record insertion is happening in a future method and ...
0
votes
2answers
110 views

How many times a database.rollback executes?

Below is the code I am executing. Account a = new Account(Name = 'xxx'); insert a; System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id]. ...
0
votes
1answer
335 views

Future method rollback

I have a System.LimitException problem: Apex CPU time limit exceeded in Apex, and I have therefore modified a synchronous functionality in asynchronous functionality by changing the method in @future. ...
3
votes
0answers
147 views

Queue/Serialize Incoming REST API Requests

I'm looking for a way to queue incoming HTTP Post requests. Apex REST API handlers are executed in parallel on separate threads. This introduces race conditions if any new records are inserted by ...
1
vote
1answer
79 views

Callouts and rollbacks

Let's say I call out to an external service, get some results, use them in a transaction which then crashes. As a result, the transaction is rolled back. The same effect can be achieved with save ...
1
vote
1answer
279 views

Rollback all completed jobs in a chain

I'm writing an application where I'm chaining jobs by calling executeBatch for the next job in the finish method of the previous one. In case a job somewhere in the chain fails, I'd need to rollback ...
4
votes
2answers
274 views

Rollback Block?

I am curious what kind of syntax is Apex method System.runAs(){ } where in curly brackets I can run my code which will be executed as passed user. I would like to write my own method with that syntax ...
1
vote
2answers
414 views

TypeException: Savepoint does not exist in this context

Is there a limitation that prevents unit tests from calling a class that uses the Database.rollback functionality? I am getting this error: System.TypeException: Savepoint does not exist in this ...
5
votes
1answer
155 views

How can I add transactional safety to Javascript DML operations?

I am using connection.js and apex.js to add DML operations to a custom VisualForce page with sforce.connection. There are actions in the page that can make multiple calls that will alter data. I'd ...
2
votes
3answers
438 views

Testing system rollback, i.e. when exception is thrown outside without handling

On our community website we have some logic which throws exception when some set of conditions is invalid. This exception is not handled by any part of our code. As result system rollback happens ...
3
votes
2answers
3k views

How to roll back a code deployment from sandbox to production

I'm reading about the Salesforce development lifecycle, but I can't figure out whether (and if so, how) Salesforce provides for rolling back a code deployment from a sandbox to production.
3
votes
3answers
386 views

Revert/rollback record states on error

Consider the following block of code that is called on save of a basic data entry page: public PageReference save() { // accounts is binded to VF page for (Account a : accounts) { ...
1
vote
1answer
619 views

Use addError method and make a DML operation

The problem that I am having is that I am using addError method in before insert trigger which actually rollback every DML I make including @future method calls, sending email, queueing batch jobs, or ...
2
votes
1answer
59 views

PHP API: Rollback behavior with multible Querys [closed]

My system imports large tables into salesforce. I want the all or nothing behavior, specified here But i can't find the corresponding function in the php SDK. Does this functionality exists in the ...
0
votes
1answer
271 views

Setting database.savepoint in one method and rolling back in another method

I have three objects ObjectA, ObjectB, ObjectC. ObjectA is the grand parent, ObjectB is child of A & Object C is child of B. I'm providing a button on ObjectA page layout to create/edit records ...
2
votes
1answer
236 views

Rollback complete batch process

I want to roll back a complete batch related transaction if there is any exception while processing anywhere during batch execution I can roll back that specific transaction, but not sure if I can ...
1
vote
1answer
188 views

Field not writable after Database.rollback() and clone()

This is my custom save method: private void saveNewMode() { Savepoint toBeforeState = Database.setSavepoint(); try { insert parent; for(ChildA__c prs : childrenA) { ...
2
votes
1answer
325 views

Transaction rollback

I am hoping if you can help clarify the rollback on transactions, for scenario below. For example if we have the piece of code below MyCustomObject__c customObj = new MyCustomObject__c (); Savepoint ...
32
votes
10answers
2k views

How can I cause side effects outside an execution context?

I've got a scenario that relies on the system's "automatic rollback" behaviour to undo any DML, emails, futures and so on, in the case of an error. Basically, by allowing code to throw an unhandled ...
2
votes
0answers
278 views

Send email in an Apex trigger (on CollaborationGroup) before calling addError

I want to have a trigger on ColllaborationGroup (Chatter group) that prevent users from deleting a group, and sending them an email for explanation. I read here and here and here that this is not ...
0
votes
1answer
102 views

Finding & Evaluating Salesforce Backup & Recovery Service Providers

Realize that anything a third-party Salesforce backup & recovery service is able to do in theory I am able to do, but short-term, I am more focused on deploying Salesforce, than recovering it. ...
3
votes
3answers
2k views

Can I rollback a Before Insert trigger from an after trigger event?

Scenario: After an object is inserted/updated (can happen after any of the two) - I update an external system with that object's info - Object ID is needed - which is why I need the After Insert. ...
1
vote
1answer
89 views

when trying to attach it getting rollback problem

I have created a VF page for generating invoice and from that VF page i am invoking a PDF VF page. In invoice VF page i saved the invoice and pass the parameter to PDF page and trying to display it. I ...
3
votes
2answers
2k views

Does Database.rollback(savepoint) work with the Update method?

I have 3 objects A, B and C. First A object which contain some amount of records. And I need to update or create a new record to the second B object. The condition is, if the user exist in the second ...
12
votes
2answers
221 views

Are Custom Settings included in a Database.rollback()?

Apex has a Transaction Control system for rolling back changes to SObjects. Are Custom Settings included in a rollback? (To be more clear, are Custom Settings reverted to the state that they were in ...
1
vote
1answer
198 views

Rolling back custom field change

Is there a way to get the prior values of a custom field for which history tracking was not setup for and neither was a PRIORVALUE field update field created for it. Thanks.
24
votes
3answers
6k views

Can I prevent an insert to be rolled back even if my class (later) runs into an exception?

I do some custom logging in my code which basically means I write and update sobject records that contain custom log information. The problem is whenever an exception is thrown in my class the ...
11
votes
3answers
9k views

Is manual Database.setSavepoint() and rollback needed on Trigger exception?

When something wents wrong in my synchronous trigger do I have to manually take care of this by before making a Database.setSavepoint() and rollback in the catch statement? Or is Salesforce.com ...
7
votes
2answers
2k views

Can we have a DML not roll back when i use an adderror method?

We have a scenario where in the before insert trigger of object Asset, which looks for a duplicate and if a duplicate is found a record is inserted in the junction table and after the dml is complete, ...
11
votes
2answers
7k views

Rolling back DML operation in Apex method

What is the best way to rollback some changes to the database inside an Apex method? For example, in an Apex method, I insert multiple records (Opportunity / Quote / QuoteLineItems). When I execute ...