Answers.Body: <blockquote>
    <p>I used contact_id_a and contact_id_b and relationship_type id and set the is_active to 0 in csv file. But this extension gives me an error "Error with entity "create"! (Duplicate Relationship)".</p>
  </blockquote>
  
  <p>Seems like you have <code>relationship_type_id</code> but not <code>relationship id</code> in the CSV file? If yes, I think you just need to add <code>Relationship id</code> to the columns.</p>
  
  <p>The <code>id</code> is used by civicrm to update the records in the database instead of creating a new one.</p>
  
  <p>Hence, try adding a new column in CSV and then proceed with the import.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-12T12:32:02.187Z
Answers.Text: Yes - where did the CSV come from? May need to do an export from Civi to get the relationship id's and match that up with the existing CSV
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T23:03:14.117Z
Answers.Text: Hi Jitendra, Thanks for replying. where can I get the Relationship ID from CiviCRM? (I know they store in the database but I don't have access to back end).So I need to get them from front end, do you know if there is an option there? I couldn't get them from CiviCRM export data.
Answers.UserDisplayName: Mehrnoosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T23:31:51.313Z
Answers.Text: Hi Aiden, How Can I export the relationship id from civicrm? Thanks
Answers.UserDisplayName: Mehrnoosh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-12T09:49:12.363Z
Answers.LastActivityDate: 2019-06-12T09:49:12.363Z
Answers.UserDisplayName: jitendra - fuzion
Answers.Body: <p>Just answering the question in the comments about how to export the relationship_id.  One way is to run a Civi relationship report from Reports | Create Reports from Templates and include the Rel ID column:<a href="https://i.sstatic.net/RGYzf.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RGYzf.jpg" alt="enter image description here" /></a>
  Then from Actions select Export as CSV.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-29T04:51:42.683Z
Answers.LastActivityDate: 2021-08-29T04:56:46.727Z
Answers.LastEditDate: 2021-08-29T04:56:46.727Z
Answers.UserDisplayName: David Letham
Body: <p>I need your help. I need to disable a current relationship for 4000 records in the import process without using SQL command line.</p>
  
  <p>There is no field for set active/inactive or expiry date of the current relationship in basic import process in CiviCRM.</p>
  
  <p>Then I found this extension here <a href="https://civicrm.org/extensions/api-csv-import-gui,I" rel="nofollow noreferrer">https://civicrm.org/extensions/api-csv-import-gui,I</a>'ve installed the extension and tried to inactive the current relationships.
  I used contact_id_a and contact_id_b and relationship_type id and set the is_active to 0 in csv file. 
  But this extension gives me an error "Error with entity "create"! (Duplicate Relationship)". I'm going to update this relationship but this extension tries to create a relationship and fails because this relationship is already existed.
  Do you have any idea how to solve this?</p>
  
  <p>Or do you have any other solution for this?</p>
  
  <p>CiviCRM version is 5.13.5.
  And the relationship type is between two organization.</p>
  
  <p>Edit: My requirement is:</p>
  
  <p>Currently I have around 5000 records with a type of relationship in CiviCRM (organization to organization -one to many). Some of these records (relationship, name, email,...) have been updated in another system (A government system) and they gave the current list to me to update our current records in CiviCRM. I've updated contact details successfully but stuck in updating relationship, Because the CiviCRM basic import creates a new relationship not overwrite the existing one. If a relationship between 2 organization has changed in new file I need to disable the one that we have in civicrm and import the new one. So in future I know which records used to be in relationship but not any more. There is no option in CiviCRM import to do this (I couldn't find any). So I was thinking to find a way to disable the current one in CiviCRM and import new list. So if the relationship is no longer available in the new file, this has been disabled already in CiviCRM and if there is still a relationship between two records, it enables that again when I'm importing.</p>
  
  <p>Thanks in advance</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-12T08:31:16.517Z
Comments.Text: Hi, Welcome to SE!  Do you have other records that need this relationship, or could you just disable that relationship type completely?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-13T23:17:50.047Z
Comments.Text: Hi Aidan, Thanks for replying. I need this relationship type  in CiviCRM. I edited my question and add more description there about what I want to achieve here. Thanks
Comments.UserDisplayName: Mehrnoosh
Tags: <drupal><custom-fields><import><relationships>
Title: Batch Update the current relationship in CiviCRM
ThreadText: # Batch Update the current relationship in CiviCRM
  
  (Asked by: username_0 on 2019-06-12)
  
  I need your help. I need to disable a current relationship for 4000 records in the import process without using SQL command line.
  
  There is no field for set active/inactive or expiry date of the current relationship in basic import process in CiviCRM.
  
  Then I found this extension here <https://civicrm.org/extensions/api-csv-import-gui,I>'ve installed the extension and tried to inactive the current relationships.
  I used contact\_id\_a and contact\_id\_b and relationship\_type id and set the is\_active to 0 in csv file.
  But this extension gives me an error "Error with entity "create"! (Duplicate Relationship)". I'm going to update this relationship but this extension tries to create a relationship and fails because this relationship is already existed.
  Do you have any idea how to solve this?
  
  Or do you have any other solution for this?
  
  CiviCRM version is 5.13.5.
  And the relationship type is between two organization.
  
  Edit: My requirement is:
  
  Currently I have around 5000 records with a type of relationship in CiviCRM (organization to organization -one to many). Some of these records (relationship, name, email,...) have been updated in another system (A government system) and they gave the current list to me to update our current records in CiviCRM. I've updated contact details successfully but stuck in updating relationship, Because the CiviCRM basic import creates a new relationship not overwrite the existing one. If a relationship between 2 organization has changed in new file I need to disable the one that we have in civicrm and import the new one. So in future I know which records used to be in relationship but not any more. There is no option in CiviCRM import to do this (I couldn't find any). So I was thinking to find a way to disable the current one in CiviCRM and import new list. So if the relationship is no longer available in the new file, this has been disabled already in CiviCRM and if there is still a relationship between two records, it enables that again when I'm importing.
  
  Thanks in advance
  
  **Tags:** drupal, custom-fields, import, relationships
  
  > **Comments:**
  > **username_1**: Hi, Welcome to SE!  Do you have other records that need this relationship, or could you just disable that relationship type completely?  
  > **username_0**: Hi username_1, Thanks for replying. I need this relationship type  in CiviCRM. I edited my question and add more description there about what I want to achieve here. Thanks  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-06-12. Score: 4
  
  > I used contact\_id\_a and contact\_id\_b and relationship\_type id and set the is\_active to 0 in csv file. But this extension gives me an error "Error with entity "create"! (Duplicate Relationship)".
  
  Seems like you have `relationship_type_id` but not `relationship id` in the CSV file? If yes, I think you just need to add `Relationship id` to the columns.
  
  The `id` is used by civicrm to update the records in the database instead of creating a new one.
  
  Hence, try adding a new column in CSV and then proceed with the import.
  
  > **Comments:**
  > **username_1**: Yes - where did the CSV come from? May need to do an export from Civi to get the relationship id's and match that up with the existing CSV  
  > **username_0**: Hi username_2, Thanks for replying. where can I get the Relationship ID from CiviCRM? (I know they store in the database but I don't have access to back end).So I need to get them from front end, do you know if there is an option there? I couldn't get them from CiviCRM export data.  
  > **username_0**: Hi Aiden, How Can I export the relationship id from civicrm? Thanks  
  
  ---
  
  ### Answer by username_3 on 2021-08-29. Score: 4
  
  Just answering the question in the comments about how to export the relationship\_id. One way is to run a Civi relationship report from Reports | Create Reports from Templates and include the Rel ID column:[![enter image description here](https://i.sstatic.net/RGYzf.jpg)](https://i.sstatic.net/RGYzf.jpg)
  Then from Actions select Export as CSV.
  
  
  ---
  
  