_list

Lists all Customers, can use given parameters as filters for returned results.

Parameters

last_edited

A filter which removes Customers that were last edited outside the range between the date given and when this function is run.

is_active

An optional filter based on if Customers are active or not: 0 => Only inactive Customers 1 => Only Active Customers

check_parent

An optional filter which checks the parent-customer-selection Setting , if this parameter is set to 1 and parent-customer-selection is set to 1, Parent Customers are not included in the results.

fields

A JSON-encoded array naming the fields which are to be returned. Valid values are:

account_number, id, name, notes, email, last_edited, industry, street_address1, street_address2, town, county, postcode, landline, mobile, contact_name, changes, edited_uuid, appId, cdate, appointments_open, appointments_closed, custom_values, callback, account_manager, meta, callback_notes, lead_acc, parent_id, latitude, longitude, is_active, country, created_by, files, department_id, city, state, last_edited_all, is_flagged, contacts, has_invoices, type, price_band, accounts_name, accounts_number, credit_terms, area_id

Examples

Without the "fields" parameter:

FM_api('Customers_list',[
    'last_edited'=> date('Y-m-d H:i:s', strtotime("yesterday")),
    'is_active'=>'1',
    'check_parent'=>'1'
  ]
);

With the "fields" parameter:

FM_api('Customers_list',[
    'last_edited'=> date('Y-m-d H:i:s', strtotime("yesterday")),
    'is_active'=>'1',
    'check_parent'=>'1',
    'fields'=>json_encode(
      [
        'is_active',
        'cdate'
      ]
    )
  ]
);

Results

Without the "fields" parameter:

[{"id":"683138","name":"A Test Customer","is_active":"1"},{"id":"683139","name":"A Test Customer2","is_active":"1"}]

With the "fields" parameter, including the is_active and cdate fields.

[{"id":"683136","name":"A Test Customer","is_active":"1","cdate":"2023-12-10 12:46:32"},{"id":"683137","name":"A Test Customer2","is_active":"1","cdate":"2023-12-10 12:46:32"}]

Last updated