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

    Optimize Customer Support Services With Salesforce Service Cloud Implementation

    Blog in Salesforce Cloud Platform

    The power to make or break a brand rests solely with the customers today. With ever-evolving customer needs, preferences, and expectations, businesses explicitly focus on…

    Automate, Automation Workflows, Bottom Line, Business Processes, Case Management
    Carol Jul 3, 2023
    1,636  Views
    Apex Testing in Salesforce

    All About Apex Testing in Salesforce

    Blog in Salesforce Apex

    Apex Unit Tests  Apex unit tests ensure superior grades for your Apex code and let you meet the essentials for deploying Apex.  Testing is the…

    Apex Testing, Apex Unit Tests, App Developers, Application, Bundle Supporters
    Shweta Choudhary Oct 12, 2021
    4,190  Views

    Salesforce Einstein Voice – Stop typing and start Selling!

    Blog in Salesforce Einstein

    Imagine each of your Sales reps had a personal assistant who could handle monotonous and boring tasks while your Sales reps stay focused on their…

    CRM, CRM Technology, Data Protection in Salesforce, Developer Org, Einstein Bots
    LevelShift (formerly DemandBlue) Nov 26, 2018
    5,837  Views

    Popular Salesforce Videos

    Introduction to Salesforce Nonprofit Cloud for Program Management

    Introduction to Salesforce Nonprofit Cloud for Program Management

    Video in Others, Salesforce Cloud Platform

    Each nonprofit’s mission and the program is unique, but with Salesforce’s highly configurable and customizable platform, you can manage your entire program from one central…

    Salesforce Video, Salesforce Learning, Salesforce Nonprofit Cloud, Program Management, Nonprofit’s Mission
    Prafull Feb 4, 2021
    2,415  Views
    Salesforce Integration Using Oracle SOA Suite

    Salesforce Integration Using Oracle SOA Suite

    Video in Salesforce Integration

    In this video, Bristlecone gives an introduction to Oracle Cloud Adapter for Salesforce.com.  Afterwards, he goes into detail about how to integrate Salesforce.com using Oracle…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce, #integration
    Rahul kapoor Sep 7, 2022
    1,958  Views
    Create an Email Alert Workflow Rule | Workflow Rules in Salesforce | Salesforce Automations

    Create an Email Alert Workflow Rule | Workflow Rules in Salesforce | Salesforce Automations

    Video in Salesforce Training

    Configuring Workflow Rule Email Alerts or Notifications Follow. Workflow Rules are automatic processes that trigger an action when a certain event occurs, such as updating…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Prafull Jun 28, 2022
    2,295  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®.

    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.