Menu
SuiteCRM Pull Request Party hosted by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: i cannot seem to figure out how to bulk delete using the api

i cannot seem to figure out how to bulk delete using the api 3 months 1 week ago #75498

  • mediaphyte
  • mediaphyte's Avatar
  • Offline
  • New Member
  • Posts: 12
  • Thank you received: 1
  • Karma: 0
below is some code I've been trying. I also tried leaving off the 'deleted' in the params array and used this:
//      $list[]=array(array('name'=>'ids','value'=>$row['meeting_id']),array('name'=>'deleted','value'=>'1'));  in the foreach.

   foreach($meetings as $row){

                        $list[]=array(array('name'=>'ids','value'=>$row['meeting_id']));
                }


                $params=array(
                        'session' => $GLOBALS['session_id'],
                        'module_name' => 'Meetings',
                       'deleted'=>'1'
                        'name_value_lists' =>
                                $list

                );
Last Edit: 3 months 6 days ago by pgr. Reason: add code tags
The administrator has disabled public write access.

i cannot seem to figure out how to bulk delete using the api 3 months 6 days ago #75532

  • mediaphyte
  • mediaphyte's Avatar
  • Offline
  • New Member
  • Posts: 12
  • Thank you received: 1
  • Karma: 0
Ah, figured it out. Time away from the screen always helps.
It seems that 'name_value_lists' is NOT the thing to try, I was confused by this in the documentation.
Here's the working code:
foreach($meetings as $row){
                        $list[]=array(array('name'=>'id','value'=>$row['meeting_id']),array('name'=>'deleted','value'=>'1'));
                }
                $params=array(
                        'session' => $GLOBALS['session_id'],
                        'module_name' => 'Meetings',
                        'name_value_list' => 
                                $list
                );
                $result=call("set_entries", $params, $GLOBALS['url']);

the foreach builds an array (of arrays) of meeting entries to delete, thus using just a single "set_entries" call.
Last Edit: 3 months 6 days ago by pgr. Reason: add code tags
The administrator has disabled public write access.

i cannot seem to figure out how to bulk delete using the api 3 months 6 days ago #75544

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 9303
  • Thank you received: 1403
  • Karma: 337
Hi @mediaphyte

thanks for sharing your solution.

Next time don't forget to wrap your code in the Forum's "code" tags, otherwise some brackets are lost.

Thanks :)

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
Time to create page: 0.372 seconds
Powered by Kunena Forum