Hey guys, I'm using Request Tracker 3.8.4 and Asset Tracker 1.2.4 on a Debian Etch box. RTFM 2.4.2 is also installed.
When a ticket is created/updated/resolved, I'm trying to search the contents of the ticket for an asset's hostname. If the hostname is mentioned in the ticket, then I'd like for a bidirectional link to automatically be created between the ticket and the asset. I've downloaded and installed the LinkTicketToAsset scrip, and it works great for what it was intended for -- whenever I enter an asset's hostname in the "Asset" custom field, it will create a bidirectional link between the asset and the ticket. However, I can't figure out how to modify it to search the entire contents of the ticket, or at least the comment/reply/resolve sections (the main text sections). Here is the custom condition of the LinkTicketToAsset scrip: my $trans = $self->TransactionObj->Type; my $new_value = $self->TransactionObj->NewValue; my $cf_id = $self->TransactionObj->Field; if ($trans ne 'CustomField') { return 0; } if (! $new_value) { return 0; } my $cf = new RT::CustomField($RT::SystemUser); my ($id,$msg) = $cf->Load($cf_id); if (!$id) { $RT::Logger->crit("Could not load CF: $msg"); return 0; } if ($cf->Name ne 'Asset') { return 0; } 1; Here is the cleanup code: my $new_value = $self->TransactionObj->NewValue; my $asset = RTx::AssetTracker::Asset->new($self->CurrentUser); my ($id,$msg) = $asset->Load($new_value); if (! $id) { $RT::Logger->crit("Could not load asset $new_value: $msg"); return 0; } ($id,$msg) = $self->TicketObj->AddLink(Type => 'RefersTo', Target => $asset->URI); if (! $id) { $RT::Logger->crit("Could not AddLink: $msg"); return 0; } 1; I'm brand new to Asset Tracker scrips so I'm having trouble understanding what I would need to change to get this scrip to work by searching the entire ticket instead of just the Asset custom field. I see where the Asset custom field is mentioned, but I'm not sure what to replace it with. Any help or recommendations on where to begin would be appreciated. Thanks! _______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com