Customers
Find customers with a filled custom value
/a/Customers_listByHasFilledValue
Find non-deleted customers whose stored custom-values JSON appears to contain a non-empty value for one field name.
When to use this endpoint
Use Customers_listByHasFilledValue only for the CRM1 customer-predictor training workflow, which first needs IDs whose configured result field is populated.
This is a legacy text-pattern check over stored JSON, not a general custom-field query API.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
val | String | Yes | Exact custom-field key to locate inside custom_values. Blank values and the string 0 are rejected by the handler’s legacy truthiness check. |
Example request
$matches = FM_api('Customers_listByHasFilledValue', [
'val' => 'Renewal decision',
]);
Example response
{
"ids": [1042, 1088]
}
IDs are explicitly converted to JSON numbers. No customer fields or matched custom values are returned.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"no \"val\" parameter"} | val is absent, blank, or evaluates false in PHP, including the string 0. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Soft-deleted customers are excluded; inactive customers are included.
- The value itself is not compared. Zero, false, null, arrays, and objects can count as filled if their stored text matches the positive pattern and not the empty-string pattern.
- Result order is undefined. There is no pagination or limit.
See it in Fieldmotion
CRM1
Open Customers → Predictors and retrain a predictor. CRM1 calls Customers_listByHasFilledValue for the model’s result custom field before fetching each customer’s training fields.
CRM2
A production-source search found no CRM2 caller. The customer-predictor page is a CRM1 feature.
Related endpoints
Customer_getCustomFieldsreads selected custom values for each returned ID.Customers_listCustomValueslists the custom-field definitions from the tenant layout.