Answers.Body: <p>There are lots of problems with the setvalue api. This is a good example of why everyone should stop using it.</p>
  
  <p>The plan is to deprecate setvalue soon and remove it in a future version. See <a href="https://issues.civicrm.org/jira/browse/CRM-16643" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-16643</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-01T09:40:34.113Z
Answers.Text: Sounds good, I've updated the documentation page.
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-30T21:34:20.257Z
Answers.LastActivityDate: 2015-06-30T21:34:20.257Z
Answers.UserDisplayName: Coleman
Body: <p>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.</p>
  
  <p>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'.</p>
  
  <p>Is this the desired behaviour?</p>
  
  <p>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 <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API" rel="nofollow">document it</a>.</p>
  
Tags: <api><addresses>
Title: API call setvalue for is_primary does not make other values 'not primary'
ThreadText: # API call setvalue for is_primary does not make other values 'not primary'
  
  (Asked by: username_0 on 2015-06-30)
  
  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](http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API).
  
  **Tags:** api, addresses
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-30. Score: 3 | Accepted answer
  
  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>
  
  > **Comments:**
  > **username_0**: Sounds good, I've updated the documentation page.  
  
  ---
  
  