Results 1 to 3 of 3

Thread: Query on State using API

  1. #1
    Join Date
    May 2013
    Posts
    7

    Default Query on State using API

    So I have a query that allows me to choose all accounts from a specific state. I get this error "Warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/sales/sugar_im_report.php on line 73". When I run this query with any other field except address, it works just fine.

    $query = "billing_address_state = 'CA'";
    but If I change the query to

    $query = "account_manager_c = 'AM'";
    it works just fine.

    Do I have to do something different with the state. When I run the query without the $query variable, I get and can display State with no problem.



    $get_entry_list_parameters = array(

    //session id
    'session' => $session_id,

    //The name of the module from which to retrieve records
    'module_name' => 'Accounts',
    //The SQL WHERE clause without the word "where".
    'query' => $query,

    //The SQL ORDER BY clause without the phrase "order by".
    'order_by' => "account_manager_c ASC, name ASC",

    //The record offset from which to start.
    'offset' => '0',

    //Optional. A list of fields to include in the results.
    'select_fields' => array(
    'id',
    'name',
    'title',
    'account_manager_c',
    'products_c',
    'students_c',
    'grade_book_c',
    'report_cards_c',
    'customer_status_c',
    'billing_address_state',
    'priordna_c',
    'sis_c',
    ),

    'link_name_to_fields_array' => array(
    ),

    //The maximum number of results to return.
    'max_results' => '50000',

    //To exclude deleted records
    'deleted' => '0',

    //If only records marked as favorites should be returned.
    'Favorites' => false,
    );

  2. #2
    dkallish Guest

    Default Re: Query on State using API

    Hello,

    I've written up an example script here on GitHub - https://gist.github.com/dkallish/8814841

    You can download this Gist, modify the script as needed for your URL, Username, Password, and fields, but please do not modify the 'query' portion. Once updated with your changes, please try running my script.

    Kind regards,

    Dan Kallish
    SugarCRM Technical Support

  3. #3
    Join Date
    May 2013
    Posts
    7

    Default Re: Query on State using API

    Thank you dkallish,
    Why did I have to put accounts. before the billing_address_state. All the other fields on that page, I can just call without the prefix.
    Thanks....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opportunities by State
    By e.johnson in forum Developer Help
    Replies: 0
    Last Post: 2011-11-15, 10:12 PM
  2. State Abbreviation
    By scommjudy in forum Help
    Replies: 1
    Last Post: 2009-09-16, 04:36 PM
  3. Easy way to add state after account name?
    By eggsurplus in forum Developer Help
    Replies: 2
    Last Post: 2008-06-03, 12:37 AM
  4. Prospects by State?
    By sduda in forum Help
    Replies: 1
    Last Post: 2007-11-09, 09:48 PM
  5. Where is session state maintained?
    By mikekenny in forum Developer Help
    Replies: 1
    Last Post: 2006-02-21, 10:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •