Answers.Body: <p>Sounds like you have to 'force' the summary page to rebuild. You can do this by re-building your userContext (which will be the summary page):</p>
  
  <pre><code>$session = CRM_Core_Session::singleton;
  CRM_Utils_System::redirect($session-&gt;readUserContext());
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-11T14:34:08.703Z
Answers.LastActivityDate: 2015-08-11T14:34:08.703Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I'm running into an issue with the api. I use the following call to write to the relationships datatable</p>
  
  <pre><code>$result = civicrm_api3('Relationship', 'create', array(
      'sequential' =&gt; 1,
      'contact_id_a' =&gt; $contact_a_id,
      'contact_id_b' =&gt; $contact_b_id,
      'relationship_type_id' =&gt; 11,//your specific relationship id
  ));
  </code></pre>
  
  <p>from my solution in <a href="https://civicrm.stackexchange.com/a/4619/765">https://civicrm.stackexchange.com/a/4619/765</a></p>
  
  <p>However, when I then go to the relationship tab the new entry is not immediately visible. I usually have to force a refresh by changing the relationships per page from 10 to 25 and then the new entry appears. How can I bypass/avoid this problem?</p>
  
  <p>Thanks,
  V</p>
  
Tags: <api><relationships><database>
Title: after i use api to update the database results not immediately showing
ThreadText: # after i use api to update the database results not immediately showing
  
  (Asked by: username_0 on 2015-08-11)
  
  I'm running into an issue with the api. I use the following call to write to the relationships datatable
  
  ```
  $result = civicrm_api3('Relationship', 'create', array(
      'sequential' => 1,
      'contact_id_a' => $contact_a_id,
      'contact_id_b' => $contact_b_id,
      'relationship_type_id' => 11,//your specific relationship id
  ));
  
  ```
  
  from my solution in <https://civicrm.stackexchange.com/a/4619/765>
  
  However, when I then go to the relationship tab the new entry is not immediately visible. I usually have to force a refresh by changing the relationships per page from 10 to 25 and then the new entry appears. How can I bypass/avoid this problem?
  
  Thanks,
  V
  
  **Tags:** api, relationships, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-11. Score: 4 | Accepted answer
  
  Sounds like you have to 'force' the summary page to rebuild. You can do this by re-building your userContext (which will be the summary page):
  
  ```
  $session = CRM_Core_Session::singleton;
  CRM_Utils_System::redirect($session->readUserContext());
  
  ```
  
  
  ---
  
  