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, 1 month 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

    APEX Rest Callout in Salesforce Integration

    APEX Rest Callout in Salesforce Integration

    Blog in Others

    The Salesforce REST API allows you to integrate with Salesforce applications by using standard HTTP methods such as GET, POST, PUT, PATCH, DELETE, and HEAD.…

    Apex Tests, Apex Triggers, Apex Unit Tests, Class Level, Code Coverage Criteria
    Rishabh Mar 13, 2023
    2,754  Views

    Best Practices for Salesforce Data Migration

    Blog in Salesforce

    Conducting data migration from or into Salesforce can be time-consuming but a necessary task. Data migration is a challenge for any enterprise. You might face…

    APIs, Bad data, Best Practices, Best Practices for Salesforce Data Migration, Best Technology
    360 Degree Jul 29, 2021
    2,646  Views
    salesforce chatter

    How to Use Salesforce Chatter Better?

    Blog in Others, Salesforce Products

    Here are 3 main STEPS, by which you can use SALESFORCE chatter more efficiently. Take a look… STEP 1: Follow relevant people and data Keep…

    Business Associates, Business Deal, Cases and Custom Objects, Chatter Administrators, Chatter Email Manager
    Algoworks Jan 16, 2017
    10,157  Views

    Popular Salesforce Videos

    See how fast and easy you can make intuitive Salesforce solutions to your users with Cauzali.

    See how fast and easy you can make intuitive Salesforce solutions to your users with Cauzali.

    Video in AppExchange

    Instead of coding or very complex flows use Cauzali. Place your Cauzali model everywhere in Salesforce including in the middle of a Flow. Price between…

    Salesforce Lightning, salesforce, Salesforce Flow, Salesforce Video, lightning
    Tom Bo May 15, 2020
    2,174  Views
    3 Tips on How To Deliver a Successful Product Launch | Salesforce on Salesforce

    3 Tips on How To Deliver a Successful Product Launch | Salesforce on Salesforce

    Video in Salesforce Products

    Salesforce defines a product launch as announcing a new offering to the public. Launches are an opportunity to tell a compelling story about your product,…

    Salesforce Training, salesforce, Salesforce Video, sales, Salesforce Learning
    Nauman May 27, 2022
    2,092  Views
    How to Start a Process with Parameters on UiPath Robots from Salesforce Interface

    How to Start a Process with Parameters on UiPath Robots from Salesforce Interface

    Video in Salesforce Apex, Salesforce Training

    How to start a process with parameters on UiPath Robots from the Salesforce interface. Watch this video and learn. Let us know in the comments…

    Salesforce Training, Salesforce Tutorial, REST, Apex, SFDC
    Cristian Nov 23, 2020
    1,814  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.