Skip to content

Reduce API calls for the FindExistingPhone... and add limit 1 to the civicrm_api3 getvalue API calls

Two changes in this MR:

  1. Reduce API calls for the FindExistingPhone, FindExistingEmail, FindExistingAddress actions
  2. Add limit 1 to the civicrm_api3 getvalue API calls to ensure at least a value is returned if found, rather than throwing an exception

The reason for change 2 was because we found that a phone field would not load using the load as a default because there had been two emails set as phone type: "mobile" and location: "main" - it is possible to set this using the API but not the UI. This was quite time consuming to track down and identify the cause. Therefore have extended this limit 1 logic to apply the change to all getvalue API calls, thus if multiple values are available instead of throwing an exception, the single value is returned.

Testing recommended. Happy to receive any review comments and feedback on this one.

Agileware Ref: CVAP-45

Edited by justinfreeman (Agileware)

Merge request reports