Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • 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
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • 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
    • Marketplace
    • Advertise With Us
    • 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 9 years, 6 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

    application solution

    Popular Salesforce Blogs

    Salesforce CRM

    How Can Salesforce CRM Boost its Sales Revenue?

    Blog in Salesforce

    Salesforce is a CRM that puts sales at the center of its operation. Salesforce has the capacity to do it just right, from acquiring precise…

    Appropriate Solution, Campaign Administration, Campaign Programs Email, Campaigns, Communication Channels
    Cymetrix Jun 4, 2021
    3,027  Views
    Revenue-Cloud

    Speed up Your Revenue Growth - Salesforce Revenue Cloud

    Blog in Salesforce Cloud Platform

    A. Salesforce Donning a New Hat Salesforce, an entity better known for its world-class products and for offering varied services ranging from Customer Relation Management (CRMs) to Enterprise…

    Application Development, Automation, B2B, billing, Business
    Algoworks Jan 14, 2022
    2,679  Views
    What are Validation Rules?

    What are Validation Rules in Salesforce in 2023?

    Blog in Others

    In this blog, we will explore the importance of validation rules and how to create them in Salesforce.  What are Validation Rules in Salesforce?  Validation…

    Create Validation Rules, Custom Validation, Data Validation Rules, Description, Detailed Object List
    Nikhil Kumar Mar 30, 2023
    1,156  Views

    Popular Salesforce Videos

    2020 Salesforce Admin Certification - OWD - Record Level Security

    2020 Salesforce Admin Certification - OWD - Record Level Security

    Video in Salesforce Certifications, Salesforce Admin

    Learning Objectives After completing this unit, you’ll be able to: Describe the difference between an object and field-level security Describe how to set org-wide default…

    Salesforce Training, Salesforce Certification, Salesforce Tutorials, Salesforce Admin, Salesforce Video
    Jogender Sep 28, 2020
    1,457  Views
    Salesforce Field Service: Complex Work and Routing | AblyPro Webinar

    Salesforce Field Service: Complex Work and Routing | AblyPro Webinar

    Video in Salesforce Field Service Platform

    Salesforce Field Service is a powerful tool designed to help businesses manage complex field service workflows and optimize their routing processes. With Salesforce Field Service,…

    salesforce, Routing in Salesforce, Salesforce Field Service, Salesforce Experts, Job
    AblyPro Oct 25, 2023
    818  Views
    Embedding Salesforce Einstein Predictions in Tableau with Tomasz Bacewicz

    Embedding Salesforce Einstein Predictions in Tableau with Tomasz Bacewicz

    Video in Salesforce Einstein

    Get the most out of Salesforce Einstein Discovery and Tableau by embedding Predictions directly in your Dashboards! Learn how from a pro. Watch this video…

    Salesforce Training, Salesforce Einstein, Salesforce Einstein Discovery, Salesforce Video, Tableau
    Abhishek Sep 3, 2020
    1,877  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

    © 2025 - 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®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.