Hello,
Does anyone know if RT-Extension-ImportCustomFieldValues is compatible with RT5? Metacpan states 4.2 and 4.4, but in another section also says greater.
I need to create custom fields with select lists that are extensive and would like a way to create them quickly vs manually.
Was interested in this extension as it would be useful.
I changed the Makefile.PL and META.yml to:
x_rt_too_new: 6.0.0
It installed on RT 5.0.8
It installs. The new menu option “Import from CSV” appears. I can upload a file, but it seems to get no further than the “Importing [file]…” stage.
So I can confirm it doesn’t work on RT 5.x.
Should be possible to do something with the REST2 API though.
So using the code in the ImportCustomFieldValues extension as a bit of inspiration, I wrote a little script to import from CSV to CustomFields:
$ ./rt_customfield.pl --file=/home/robl/custom_fields.csv --replace
>> Old value 286 deleted
>> Old value 287 deleted
>> Field: TestImport, Value: Option 1 successfully imported
>> Line 2: missing field: Description
>> Old value 288 deleted
>> Field: TestImport, Value: Option 1 successfully imported
>> Field: TestImport, Value: Option 2 successfully imported
I had to add an extra column to the CSV to tell it which CF to import the values to. CF names are not unique system-wide though, so it may need some further improvement to tell it where you want to import the CF to (i.e. ticket queue CF, global CF, user, group etc.)
The CSV looks like:-
CustomField;SortOrder;Name;Description;Category
TestImport;0;Option 1;Some Desc;CAT 1
TestImport;10;Option 2;;Some other thing;CAT 2
I like to add a header row, because then the exact order of the fields doesn’t matter. It also doesn’t matter if the CSV contains other columns not used by the script. But it’s a simple change to the script if the CSV has no headers. The delimiter etc. can also be changed.
Importantly I want to make this script export an existing CF to a CSV. This allows taking a backup in case you need to undo it, and also I want to be able to set up the CFs etc and get it all correct on my test RT server, before exporting it and importing it on the live box.
If I clean this script up a bit, would you be interested in it?
Emmanuel & Rob,
Thank you for working together to update this extension. My team hasn’t tried to install it yet, so i’ll ask them to hold until it’s RT5 compatible. Please keep me posted.
I couldn’t see anything interesting in the logs. Restarted and cleared the mason cache a few times. Reinstalled it a couple of times.
But on my test 5.0.8 at least, I couldn’t get it to move past the “Importing…” step. I thought it may be a permissions thing, but I tried it as root user also.
CSV file I tried looked like:
0;Option 1;Some Desc;;
10;Option 2;;Some other thing;;
I tried various things, including invalid values to try and make it throw an error somewhere, but nothing changed.
So I go on a CF, I click on Import from CSV, I choose a file to import and click on “Import”, then I get a screen with “Importing test.csv” and a table with the list of values to be imported. Then I click on “Confirm” and I’m back at the initial import screen with a yellow backgrounded text listing the actions done.