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, 2 months 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

    Pardot Activities

    How to Show Pardot Activities in Salesforce?

    Blog in Salesforce Products

    Introduction on Showing the Pardot Activities in Salesforce Do you think it is necessary to keep Pardot Email Activities in Salesforce?   This post will provide…

    Business Case, Connector Preferences Page, CRM, Email Activities, Email Logging
    SP Jun 13, 2022
    2,691  Views

    Salesforce Developers Guide: Build Your App With Salesforce AppExchange

    Blog in AppExchange

    Are you looking to start building Salesforce apps? You probably have a comprehensive understanding of how Salesforce works and know that there are many things…

    AppExchange, AppExchange Development, Automated Production Scheduling, Business Goals, Business Operations
    Infodriven Apr 9, 2024
    1,306  Views
    How Agentforce Sales Speeds Up the Lead-to-Cash Cycle with MuleSoft and Flow

    How Agentforce Sales Speeds Up the Lead-to-Cash Cycle with MuleSoft and Flow

    Blog in Salesforce

    Sales teams lose time at every handoff. A lead sits in one system. A quote lives in another. Approvals crawl through email. By the time…

    Salesforce Agentforce, Salesforce Agentforce Sales
    James Jul 15, 2026
    427  Views

    Popular Salesforce Videos

    Salesforce TrailheaDX '18 Opening Keynote - Part 4: Build Apps Fast

    Salesforce TrailheaDX '18 Opening Keynote - Part 4: Build Apps Fast

    Video in Trailhead

    Salesforce TrailheaDX ’18 Opening Keynote – Part 1: Create Connected Customer Experiences TrailheaDX ’18 Opening Keynote – Part 2: Salesforce Platform TrailheaDX ’18 Opening Keynote…

    Salesforce Records, Salesforce Lightning, Salesforce Einstein, Salesforce Trailhead, Lightning App Builder
    Abhay Apr 3, 2018
    1,845  Views
    What are Roll-up Summary Fields in Salesforce? | How to create them?

    What are Roll-up Summary Fields in Salesforce? | How to create them?

    Video in Others, Salesforce Training

    In this video, Shrey is not only teaching but also demonstrating to you "What are Roll-up Summary Fields in Salesforce?". You will be learning: 1.…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Journey with Salesforce
    Rupal Kakkar Sep 28, 2020
    2,024  Views
    Salesforce Online Training Videos For Beginners | Campaign Management

    Salesforce Online Training Videos For Beginners | Campaign Management

    Video in Salesforce Training

    Learn all about the Salesforce campaign management in this video. Watch and learn. If you have any doubts or questions, please let us know in…

    Salesforce Training, Salesforce Tutorial, Salesforce Online Training, Salesforce Video, Salesforce Learning
    Abhishek Mar 11, 2021
    2,387  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.