<& /Elements/Header, Title => loc("Asset Import") &> <& /Elements/Tabs &> <& /Elements/ListActions, actions => $results &> Run scrips: Detailed transactions:

The format of the import file is very important. The best way to get the correct format is to do an asset search and click "Importable Spreadsheet." Make all changes in this spreadsheet and import it.

To create new assets enter 'new' in the 'id' column. An ID number will be assigned automatically.

Run scrips: Will run scrips for every transaction. Don't run scrips if you don't have to. If there is an error during import the database will be rolled back (changes undone), but if a scrip happens to do a database commit then transactions cannot be rolled back on error.

Detailed transactions: When an existing asset is updated an "Update" transaction will be recorded, unless this option is selected which will cause a transaction to be recorded for every change in the asset. <%INIT> my $results = []; unless ( $session{CurrentUser}->HasRight( Object => $RT::System, Right => 'AssetImport') ) { Abort(loc("No permission to perform asset import.")); } if ($Import && $XML) { my $cgi_object = $m->cgi_object; my $fh = $cgi_object->upload('XML'); my $filename = "$fh"; my ($buffer, $xml_data); while ( my $bytesread = read( $fh, $buffer, 4096 ) ) { $xml_data .= $buffer; } my $assets = RTx::AssetTracker::Assets->new($session{CurrentUser}); my $rv; eval { ($rv, $results) = $assets->ImportXML($xml_data, $RunScrips, $Detailed); unshift @$results, loc("Asset import errors. No changes were made.") unless $rv; }; if ($@) { unshift @$results, loc("Asset import exception: [_1]", $@) unless $rv; } } <%ARGS> $Import => undef $XML => '' $RunScrips => 0 $Detailed => 0