AnsweredAssumed Answered

Help! Using Beans from command line script?

Question asked by Jeff C on Apr 10, 2016
Latest reply on Apr 11, 2016 by Jeff C

Trying to write a utility to associate imported contacts with imported accounts (using alternate account id from import. I'm getting 'Class 'Accounts' not found'  what do I need to add to the script to get it to work?


if(!defined('sugarEntry'))define('sugarEntry', true);


require 'data/BeanFactory.php';



$pdo = new PDO($dsn, $user, $pass, $opt);


$stmt = $pdo->query('SELECT bridge_account_id_c,id_c FROM accounts_cstm');

while ($account_row = $stmt->fetch())


  echo $account_row['id_c']."\n";

  $stmt2 = $pdo->query("SELECT id_c FROM contacts_cstm WHERE bridge_account_id_c = '".$account_row['bridge_account_id_c']."'");

  while ($contact_row = $stmt2->fetch())


  $bean = new Accounts();