2

I was new to CiviCRM, I have the following where %search is a variable in the php, it didn't return anything, is it true that cannot passed parameter in this way? Thanks

$contacts = civicrm_api4('Contact', 'get', [ 'select' => [ 'id', 'display_name', ], 'where' => [ ['OR', [['id', 'CONTAINS', $search], ['display_name', 'CONTAINS', $search]]], ], 'limit' => 25, ]);

1 Answer 1

1

It's probably a permissions issue. By default anonymous doesn't have access to contacts, so you either need to add 'checkPermissions' => FALSE to the parameters or run it as a logged in user with appropriate permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.