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 prevent a Salesforce record from being deleted in account object when rating is set to hot?

    Tagged: Account Object, Rating, Salesforce Records

    • Salesforce® Discussions

      How to prevent a Salesforce record from being deleted in account object when rating is set to hot?

      Posted by Radhakrishna on August 21, 2017 at 4:04 AM

      trigger Tour on Account (before insert ) {
      Account sam=Trigger.new[0];
      if(sam.Rating=='Hot' )
      {
      sam.AddError('record cannot be deleted');
      }
      }

       

      Even though when I run this record is deleting.

      can someone help me with this ?

      Shaharyar replied 9 years ago 2 Members · 1 Reply
      • Account Object
      • Rating
      • Salesforce Records
    • 1 Reply
    • Shaharyar

      Member
      August 21, 2017 at 6:19 AM

      trigger preventDeletionAccount on Account (before delete) {
      List<Account> acc=new List<Account>();
      for(Account acc:trigger.old)
      {
      if(acc.Rating=='Hot'){
      acc.addError('Prevents Deletion');
      }
      }
      }

    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

    Salesforce Implementation Best Practices for Seamless Data Migration

    Blog in Salesforce

    Implementing Salesforce is a major milestone for any business looking to improve customer relationship management, streamline operations, and gain better insights from data. However, the…

    Salesforce Data Migration, Salesforce Implementation
    Dean Aug 3, 2026
    113  Views
    Salesforce AppExchange

    Salesforce AppExchange - A Brief Guide

    Blog in AppExchange

    Salesforce is the world's leader in CRM due to the variety of customer process that enables the platform with out of the box modules. Salesforce…

    App Marketplace, Apps, Automate Data Operations, Automation Flows, Automation Processes Apps
    yash Sep 23, 2021
    2,212  Views

    Pardot Audit: How and Why It is Essential to Conduct One Today | Salesforce

    Blog in Salesforce Products

    Pardot is a powerful B2B marketing tool that allows marketers to run and manage multiple campaigns with ease. It is capable of automating processes and driving…

    Automating Processes, B2B, B2B Marketing Tool, Best Practices, Bulk Data
    LevelShift (formerly DemandBlue) Dec 17, 2020
    3,639  Views

    Popular Salesforce Videos

    Create Custom App in Salesforce | Salesforce Custom App | Salesforce Tutorial

    Create Custom App in Salesforce | Salesforce Custom App | Salesforce Tutorial

    Video in Salesforce Training, Salesforce Apps

    Watch this amazing video to learn how to create a custom app in Salesforce. Salesforce is a cloud-based platform that has transformed how companies have…

    Salesforce Training, Salesforce Tutorial, salesforce, Learn Salesforce, Salesforce Video
    Pooja Nov 13, 2020
    2,339  Views
    How Do All Salesforce Products Come Together

    How Do All Salesforce Products Come Together

    Video in Salesforce Products

    The products of Salesforce run completely in the cloud. Therefore, the companies don’t need to fret about costly maintenance and setup charges. Additionally, cloud technology…

    Salesforce Training, Salesforce Products, Salesforce Tutorial, salesforce, Salesforce Video
    Prafull Aug 26, 2022
    1,963  Views
    App to Track Your Trailblazer Journey | Are you a Trailblazer? | Mini Project | Salesforce Tutorials

    App to Track Your Trailblazer Journey | Are you a Trailblazer? | Mini Project | Salesforce Tutorials

    Video in Salesforce Training, Salesforce Apps

    In this video I will create an App to track our Trailblazer Journey. You will find out if you are a Trailblazer by watching this…

    salesforce, Salesforce Tutorials, Salesforce Video, Salesforce Projects, Salesforce Learning
    Kapil May 14, 2020
    3,133  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.