User Filter with primary_address equals true

Hello,

i want to get all employees(users) with an POST API Call where the "status" is active and the "primary_address=true". For the "status" my filter works, but for the "primary_address=true" i get an error that the system can't find the attribut.

Im using postman(sugar_v10) with this filter:

{
"filter": [
{
"$and": [
{
"status": {
"$equals": "Active"
}
},
{
"email.primary_address" : {
"$equals": true
}
}
]
}
],
"max_num": -1,
"fields": "id,name,date_modified,email"
}

Can anybody please help?

Best regards

  • The attribute "email" is an array in the returned JSON string.

    So it cannot be filtered directly. 

    So you can retrieve all active Employees/Users and then you have to run through the returned values for the email array and search for primary_address = true.

    As there is always a primary_address if the user has at least one email address, normally all active useres would be returned.

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH