2

I spoke too soon, there was one hiccup on the recent upgrade.

I have a bit of custom code on one site that pulls contacts based on 'Primary Address country' as follows (example):

$contactcount=civicrm_api("Contact","getcount", array ('version' =>'3', 'contact_type' =>'Organization', 'country' =>'United States');

When I try this on the API Explorer on the demo site, I get this error:

"error_message":"A fatal error was triggered: United States is not of the type Positive"

API Explorer

It seems to have stopped working with an upgrade from 4.6.7 to 4.6.9. Did something change in the API call?

Update:

I was trying to rough in some temporary code to make this functional by using the Country ID instead of the Country Name, and there seems to be a problem there, too. The country ID field in the API seems to be essentially ignored.

$contactcount=civicrm_api("Contact","getcount", array ('version' =>'3', 'contact_type' =>'Organization', 'country_id' => 1228);

I verified this on the demo site, too. I have opened a bug ticket for this.

1

This has been fixed at https://github.com/civicrm/civicrm-core/pull/6985 where you can get the Contact using different address fields specifying the names (country, state_province, etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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