Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to use save points in apex class while saving data and how to implement it?

    Tagged: Account, Database, Salesforce Apex, Salesforce Apex Class, Salesforce SOQL

    • Salesforce® Discussions

      How to use save points in apex class while saving data and how to implement it?

      Posted by Naman on April 30, 2016 at 6:07 PM

      How to use save points in apex class while saving data and how to implement it?

      Surbhi replied 10 years, 2 months ago 2 Members · 1 Reply
      • Account
      • Database
      • Salesforce Apex
      • Salesforce Apex Class
      • Salesforce SOQL
    • 1 Reply
    • Surbhi

      Member
      June 9, 2016 at 1:19 PM

      Hi Naman,

      Try using this approach, hope this will help you:

      Account a = new Account(Name = 'Abc');

      insert a;

      System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
      AccountNumber);

      // Create a savepoint while AccountNumber is null
      Savepoint sp = Database.setSavepoint();

      // Change the account number
      a.AccountNumber = '123';
      update a;
      System.assertEquals('123', [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
      AccountNumber);

      // Rollback to the previous null value
      Database.rollback(sp);
      System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
      AccountNumber);

      Thanks

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Auditing Salesforce Org

    Auditing Salesforce Org - Salesforce Security Guide

    Blog in Salesforce

    As we all know, security is the first priority in Salesforce. Salesforce provides different types of security features so customers' data is safe. In this…

    API, API Type, Application, Audit our Salesforce Organizations, Auditing features
    rajesh andani Jul 15, 2021
    5,906  Views
    The Future of Salesforce Development

    The Future of Salesforce Development: What to Expect

    Blog in Salesforce

    Salesforce, the cloud-based CRM giant, has revolutionized how businesses manage and grow their customer relationships. As technology continues to evolve at a rapid pace, the…

    HashStudioz Feb 7, 2024
    1,258  Views
    External ID in Salesforce

    What is External ID in Salesforce - The Definitive Guide

    Blog in Salesforce, Salesforce Apex

    In this blog, we will discuss the External ID in Salesforce. So, An External ID is a custom field that has the External ID attribute,…

    Custom Field, Custom Fields, Data Type, Description, DML Operation
    bhawana Nov 16, 2022
    6,085  Views

    Popular Salesforce Videos

    Creating Multi Screen Wizard Using Apex and Visualforce Salesforce

    Creating Multi Screen Wizard Using Apex and Visualforce Salesforce

    Video in Visualforce, Salesforce Apex, Salesforce Training

    Watch this video to learn how to create a Multi-screen wizard using Apex and Visualforce Salesforce. If you have any questions do let us know…

    Salesforce Training, Salesforce Tutorial, Salesforce Apex, salesforce, Apex
    Abhishek May 28, 2021
    2,147  Views
    5 Benefits of Integrating Mulesoft Into Your Business | Salesforce Integration

    5 Benefits of Integrating Mulesoft Into Your Business | Salesforce Integration

    Video in Salesforce Integration

    The MuleSoft integration solution has provided visionaries throughout the world with the power to connect all their data, systems, and devices seamlessly. Swipe to know…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce, Salesforce Video
    Cyntexa Jul 5, 2022
    1,473  Views
    A Walkthrough of Visual Configuration

    A Walkthrough of Visual Configuration

    Video in Others

    Whether you manufacture building, furniture, or industrial products, our product configurator guides your customers in making better purchase decisions. These 3D visualization technologies used in…

    Process Automation
    Hitech Sep 5, 2025
    231  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.