I’ve been playing with initialdata in order to script the creation of RT instances with a complex set of queues, ACLs and custom fields. I can create definitions for all of these (plus templates, scrips, etc) in a script that builds the initialdata.pm
file from external source data.
However, some of the custom fields are associated with the queues themselves (not tickets in those queues - the LookupType is RT::Queue
, not RT::Queue-RT::Ticket
). When I create the queue in initialdata.pm
, how do I instantiate the required custom field values for that queue? Is that something that should be done in @Final
or is it related to attributes?
Well after the resounding silence, I assume I must be the first person to wander down this path, so to help out anyone following me later, I can say that I’ve successfully used @Final
to instantiate queue based CFs. I end up with an @Final
that contains lots of lines like this:
$queueObj->Load("Wibble Components");
($id, $msg) = $queueObj->AddCustomFieldValue(
Field => "Organisation Type",
Value => "Tenant",
);
if(!$id) {
warn "Could not add 'Tenant' for custom field 'Organisation Type' for 'Wibble Components' because $msg";
}
In my case I’ve written a Perl script to generate the initialdata.pm
file so there can be hundreds of similar lines in @Final
, along with all the other logic for stopping duplicate scrips from being created, etc.