System Admin and Configuration

Get Involved. Join the Conversation.

Topic

    JLFolkman
    Multi-Edit / Delete more than 250 records at a time
    Topic posted August 28, 2019 by JLFolkman Gold Trophy: 10,000+ Points 
    54 Views, 3 Comments
    Title:
    Multi-Edit / Delete more than 250 records at a time
    Summary:
    Need ability to multi-edit / delete more than 250 records at a time
    Content:

    We have an integration that created over 200K records in a custom objects and need to remove everything. Is there any other way besides the multi-edit of 250 records at a time?

    Comment

     

    • Sebastiaan Draaisma

      Mass deletion can be done through ROQL (also through REST & SOAP)
      Mass edit can be done through API (REST & SOAP)

      ROQL Delete examples

      DELETE from Incidents LIMIT 1000; DELETE from Incidents LIMIT 1000; DELETE from Incidents LIMIT 1000; DELETE from Incidents LIMIT 1000;
      DELETE FROM Incidents WHERE ID >= 1 AND ID < 1000; DELETE FROM Incidents WHERE ID >= 1000 AND ID < 2000; DELETE FROM Incidents WHERE ID >= 2000 AND ID < 3000;
      DELETE FROM Opportunities WHERE ID < 150000 LIMIT 1000; DELETE FROM Opportunities WHERE ID < 150000 LIMIT 1000; DELETE FROM Opportunities WHERE ID < 150000 LIMIT 1000;
      DELETE from Contacts WHERE CreatedTime < '2014-01-01T00:00:00Z' LIMIT 1000; DELETE from Contacts WHERE CreatedTime < '2014-01-01T00:00:00Z' LIMIT 1000;
       

      The maximum number of objects that can be deleted per an API request is 20,000. The maximum number of statements that can be specified in a query is 100

      Source: ROQL Advanced Query Delete

      The ROQL query can be made in the CCOM explorer: https://<yoursite>.custhelp.com/ci/admin/explorer/
      My advice is to run a SELECT query first, just to confirm you are having the right data before changing it into a DELETE

    • JLFolkman

      We were able to delete from the Custom Object but had to do 1000 at a time.

      • Rasheed Ahamed

        Hi,

        I think you can delete them using Custom Script. Here instead of Incident object you can try giving your Custom Object path.
         

        <html>
        <head>
        <title>Delete Incident Records</title>
        </head>
        <body>
        <form method="post">
        <label>Enter Incident ID from <label/><input type="text" name="from"/><label> To </label><input type="text" name="to"/><label> <label>Delete Incidents</label><br/>
        <input type="submit" name="submit"/><br/>
        </form>
        </body>
        </html>
         
        <?php
        require_once(get_cfg_var("doc_root") . "/ConnectPHP/Connect_init.php");
        use RightNow\Connect\v1_2 as RNCPHP;
        initConnectAPI("username","password");
         
        if(isset($_POST['submit']))
        {
        $from = $_POST['from'];
        $to = $_POST['to'];
         
        for($i=$from;$i<=$to;$i++)
        {
           $incident = RNCPHP\Incident::fetch($i);
           $incident->destroy();
           RNCPHP\ConnectAPI::commit();
           echo "<br/>";
           echo("Incident Deleted with ID -> ".$i);
           echo "<br/>";
        }
        }
        ?>