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, 5 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

    What Sets Salesforce Apart as the Top CRM Choice?

    What Sets Salesforce Apart as the Top CRM Choice?

    Blog in Salesforce

    In today’s competitive business landscape, choosing the right Customer Relationship Management (CRM) system is crucial for an organization’s success. With a multitude of CRM options…

    AppExchange, community, CRM, Customer 360, Customization
    Kizzy Consulting May 3, 2024
    951  Views
    Automation studio in Marketing cloud

    Automation studio in Marketing cloud

    Blog in Others

    Automation Studio - Automation Studio makes Marketing Cloud email sends, queries, imports, and more happen automatically. Automation Studio is a Salesforce Marketing Cloud application used…

    Attribute Value, Automation Studio, Data Extension Record, Data Extract, Marketing Automation
    Rajan Aug 29, 2018
    5,786  Views
    Apex Trigger In Salesforce

    Apex Trigger In Salesforce - Get Started

    Blog in Salesforce Apex

    The trigger is an apex code that executes before and after the DML operations. Following are the DML operations:- Insert Update Delete Upsert Merge Undelete…

    Apex Trigger, Apex Trigger in Salesforce, Before Trigger, Creating and Updating an Account, Database
    Anshu Dec 7, 2021
    5,000  Views

    Popular Salesforce Videos

    About Queueable Apex | Asynchronous Apex in Salesforce | Learn Salesforce Development

    About Queueable Apex | Asynchronous Apex in Salesforce | Learn Salesforce Development

    Video in Salesforce Apex

    Queueable apex is an asynchronous apex method. It's similar to the @future method. By using this queueable interface, we can process an Apex that runs…

    Salesforce Training, Salesforce Tutorial, salesforce, Learn Salesforce Development, Salesforce Video
    Abhishek May 11, 2022
    1,793  Views
    Salesforce Commerce Cloud Migration Key Considerations

    Salesforce Commerce Cloud Migration Key Considerations

    Video in Salesforce Cloud Platform, Salesforce Training

    Embarking on a Salesforce Commerce Cloud migration journey? This extract from our latest webinar outlines the key considerations and best practices to ensure a seamless…

    salesforce, Salesforce Commerce Cloud, Salesforce Video, Commerce Cloud, Latest Webinar
    Cyntexa Nov 24, 2023
    1,194  Views
    Salesforce Sales Cloud Implementation

    Salesforce Sales Cloud Implementation

    Video in Sales, Salesforce Cloud Platform, Salesforce Implementation

    There are many things to take into consideration when developing and deploying a Salesforce Sales Cloud implementation that will take your business to the next…

    Salesforce Training, Salesforce Sales Cloud, Salesforce Implementation, salesforce, Salesforce Cloud Platform
    DB Mar 29, 2022
    2,742  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.