Questions tagged [savepoint]

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 ...
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
42 views

will database.savepoint work for delete operation

i have scenario like in a single transaction i am doing 2 DML operation. First one is delete,second one is update. If i get any issue while update the record , the deleted record should be reverted ...
3
votes
2answers
282 views

Does Apex transaction control have a context or scope?

Is Apex transaction control equivalent to .Net transaction scope where it only rolls back the transaction within scope? Will it rollback all the records that has been inserted between Database....
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 ...
0
votes
1answer
120 views

Save point issue

Hi I have controller which is creating the parent records and we are calling some different controller to create child records, want to roll back all if any of the child record get fail how can we ...
1
vote
1answer
709 views

Custom Save function for a Button

I believe cardRequest is the primary culprit in this issue. It is the record object. Why does my save function not save and create a record of the page I am trying to save? public PageReference ...
0
votes
1answer
429 views

Error using Database.Savepoint in Apex Test class

I have a test class with the following function in it: @isTest private static void testDequeue() { ... // a LOT of setup code here Test.startTest(); Savepoint sp = Database.setSavepoint()...
1
vote
2answers
415 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 ...
2
votes
1answer
249 views

Does this SavePoint do anything?

We installed our package in a client org that does a callout from a trigger to sync with their system. The client has classes that set savepoints causing errors with the callouts and I want to make ...
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 ...
0
votes
1answer
272 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
566 views

Update Opportunity Page Layouts per each Opportunity Stage

I have two Opportunity Stages. Stage A and Stage B. When I move from Stage A to Stage B, I want certain fields on the page to appear and certain fields to be made required (that were not originally ...
27
votes
2answers
483 views

How to write the superduper (=proper and stable) Custom Save method

Custom Save actions in Apex are tricky! Here are my requirements which I was unable to fulfill without harming the stability of my code: Save for New and Edit (works with record with and without Id) ...
1
vote
3answers
148 views

Custom Save on New/Edit page - Is this valid code?

In my controller extension I have a custom save method that works for New and Edit scenarios also saves modified child records The below code works in all unit tests but starts to show strange ...
5
votes
2answers
724 views

Does one use savepoints in triggers?

It's not clear to me. Suppose I write an after update trigger on opportunity to update some related accounts and then contacts. Now I lets suppose that I had luck with the accounts but the second ...
3
votes
1answer
486 views

“Data not available” when using Database.rollback() in custom save action

In my custom edit page for LineItem__c records I have overriden the save button with my own implementation which does not only save the record itself but also change to child records. <apex:page ...
2
votes
1answer
271 views

using savepoint in extension controller

I have a extension controller for my Visualforce Page. It has 2 Action methods, method1() and method2(). Each method executes DML statements. if there is failure in method2(), I need to rollback the ...
6
votes
1answer
1k views

Salesforce UnitTest exception message: “You cannot make callout after creating a Savepoint” test error

I have noticed very strange behavior while executing test. In one method on the class i test Savepoint is created. This method is used also in test for creation of records. After that there is a ...
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 ...