Questions tagged [savepoint]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1 votes
2 answers
66 views

How do I fix Not Serializable: System.Savepoint error on custom Visualforce Page?

I am trying to use a Savepoint to rollback changes on a Visualforce Page (only when there is an Exception). I am using a custom controller with a custom save method (triggered by a button). When I ...
the-mad-neuroscientist's user avatar
0 votes
1 answer
54 views

I/m getting error msg: Variable does not exists: spt in line no 25

account acc = [select id, name from account limit 1]; Opportunity Opp = new opportunity(); list<opportunity> Listopp = new list <opportunity> (); if (acc!=null) { for (integer i=0;i<...
user126394's user avatar
3 votes
2 answers
550 views

Getting "Please commit or rollback before calling out" after calling rollback()

I've always known that you can't make a callout after performing a DML operation because of holding the database transaction open, but I always assumed you could do a rollback prior. This is pseudo ...
Matt Lacey's user avatar
  • 25.6k
0 votes
0 answers
109 views

Scope of SavePoint variable

I am trying to upsert parent records in a class as well as it calls another class which inserts child records. I am trying to add Savepoint to rollback the transaction and prevent parent record from ...
Manish Anand's user avatar
0 votes
2 answers
1k views

Database.rollback() Method Not Working In Different Transaction?

I have created a very simple scenario where I'm creating a savepoint and trying to rolling back in future method. The behaviour is little confusing - I tried searching it over the net but I didn't ...
sfdcnewbie's user avatar
1 vote
1 answer
1k views

savepoints and rollbacks with future methods - does it rollback changes from other transactions

According to salesforce docs on savepoints and rollbacks: Apex gives you the ability to generate a savepoint , that is, a point in the request that specifies the state of the database at that time. ...
eaeaoo's user avatar
  • 928
0 votes
1 answer
1k 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 ...
Arthlete's user avatar
  • 4,907
0 votes
2 answers
838 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]. ...
Pankaj Andhale's user avatar
0 votes
1 answer
371 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 ...
Sarath Bhusarapu's user avatar
3 votes
2 answers
796 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....
WenHao's user avatar
  • 315
1 vote
1 answer
151 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 ...
ipavlic's user avatar
  • 3,694
0 votes
1 answer
291 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 ...
Vishwa's user avatar
  • 43
1 vote
1 answer
1k 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 ...
Quite Curious's user avatar
0 votes
1 answer
2k 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()...
coldspeed's user avatar
  • 701
2 votes
2 answers
1k 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 ...
Mossi's user avatar
  • 3,926
2 votes
1 answer
922 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 ...
dphil's user avatar
  • 6,185
5 votes
1 answer
259 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 ...
Chris Payne's user avatar
0 votes
1 answer
744 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 ...
Priyanka's user avatar
  • 1,909
2 votes
1 answer
1k 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 ...
Clehan1's user avatar
  • 879
28 votes
2 answers
522 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) ...
Robert Sösemann's user avatar
1 vote
3 answers
162 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 ...
Robert Sösemann's user avatar
5 votes
2 answers
1k 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 ...
user682217's user avatar
  • 1,171
3 votes
1 answer
533 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 ...
Robert Sösemann's user avatar
2 votes
1 answer
345 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 ...
apn's user avatar
  • 1,722
9 votes
1 answer
4k 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 ...
zokito's user avatar
  • 672
11 votes
4 answers
11k 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 ...
Robert Sösemann's user avatar