3

When using the CiviCRM API to make a field primary, other fields in the set do not have the 'is_primary' flag removed. This results in multiple 'primary' fields.

Eg: Address A is primary. The setvalue API call is used to set is_primary on Address B. Now addresses A and B both have 'is_primary'.

Is this the desired behaviour?

I can see that setvalue is intended to be quite a low level function, so you might not expect it to unset is_primary on other fields in the set. But if this is the desired behaviour we should probably document it.

3

There are lots of problems with the setvalue api. This is a good example of why everyone should stop using it.

The plan is to deprecate setvalue soon and remove it in a future version. See https://issues.civicrm.org/jira/browse/CRM-16643

  • Sounds good, I've updated the documentation page. – John Jul 1 '15 at 9:40

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.