Questions tagged [savepoint]

The tag has no usage guidance.

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

Trailhead : Data Integration Specialist Challenge 5

Error completing task: "Apex REST service does not appear to be using a SavePoint to rollback change when an exception occurs." I am using SavePoint but its not completing the Challenge. Can someone ...
0
votes
2answers
32 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 ...
1
vote
1answer
48 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. ...
0
votes
1answer
121 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
193 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
76 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
403 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
99 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
150 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
803 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
588 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
551 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
346 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
171 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
355 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
651 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 ...
28
votes
2answers
495 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
151 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
805 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
492 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
291 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
2k 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
10k 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 ...