From e2ee08616ddedb3ea44b1f84e243aa72e458f3ab Mon Sep 17 00:00:00 2001 From: Jason Crome Date: Fri, 10 May 2024 13:22:12 -0400 Subject: [PATCH] Add example of importing TSV files --- lib/RT/Extension/Import/CSV.pm | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/RT/Extension/Import/CSV.pm b/lib/RT/Extension/Import/CSV.pm index 7a13017..ce82716 100644 --- a/lib/RT/Extension/Import/CSV.pm +++ b/lib/RT/Extension/Import/CSV.pm @@ -1631,7 +1631,38 @@ Then run the import: =head2 Import a tab-separated value (TSV) file -TODO +To generate a sample TSV file, select B from +your RT menu. Pick some criteria, and don't change the default display +format or column selections. Click B. On the +resulting search result page, select the B option. + +The following configuration (saved as F) should match the +resulting TSV file: + + Set($TicketsImportTicketIdField, 'id'); + + Set( %TicketsImportFieldMapping, + 'Queue' => \'General', + ); + + Set( %CSVOptions, ( + binary => 1, + sep_char => "\t", + quote_char => '', + escape_char => '', + ) ); + +The double-quotes match the interpolated tab value, rather than a literal +C<\t>. Other columns automatically align with fields in RT, so no +additional mapping is required. + +Importing is similar to the previous example: + + /opt/rt5/local/plugins/RT-Extension-Import-CSV/bin/rt-extension-import-csv \ + --type ticket \ + --config TabImport.pm \ + --insert-update \ + Results.tsv =head2 Import users from another system